static void Main(string[] args) { Gameboard.GAMEINIT(); // game loop while (true) { Gameboard.TURNINIT(); PlayerLogic.DoTurn(); // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); //Console.WriteLine("WAIT"); // MOVE <x> <y> | WAIT } }
private static bool ShouldYell() { if (_yellsLeft > 0 && !GetMyEffects().Any()) { int countPlayersAroundMe = Gameboard.GetOtherExplorers().Where(x => Gameboard.MyExplorer.GetDistanceTo(x) <= 1).Count(); if (countPlayersAroundMe >= 1) { bool newPlayerFound = GetOtherExplorers().Where(x => Gameboard.MyExplorer.GetDistanceTo(x) <= 1 && !AlreadyYelledPlayerIDs.Contains(x.ID)).Any(); int countEnemiesAroundMe = Gameboard.GetActiveEnemies().Where(x => MyExplorer.GetDistanceTo(x) <= 3).Count(); if (countEnemiesAroundMe >= 1) { return(true); } } } return(false); }
private static void Wait() { if (_plansLeft > 0 && !GetMyEffects().Any() && MyExplorer.Sanity <= 200) { int countPlayersAroundMe = Gameboard.GetOtherExplorers().Where(x => Gameboard.MyExplorer.GetDistanceTo(x) <= 2).Count(); if (countPlayersAroundMe > 1) { CastPlan(); return; } } if (_lightsLeft > 0 && !GetMyEffects().Any()) { int countEnemiesAroundMe = Gameboard.GetActiveEnemies().Where(x => MyExplorer.GetDistanceTo(x) <= 5).Count(); if (countEnemiesAroundMe > 2) { CastLight(); return; } } Console.WriteLine(Actions.WAIT); }
public static void GAMEINIT() { int width = int.Parse(Console.ReadLine()); int height = int.Parse(Console.ReadLine()); Gameboard = new Gameboard(width, height); for (int row = 0; row < height; row++) { string line = Console.ReadLine(); for (int col = 0; col < line.Length; col++) { char symbol = line[col]; Gameboard.Fields[col, row] = new Field(col, row, symbol); } } string[] inputs = Console.ReadLine().Split(' '); SanityLossLonely = int.Parse(inputs[0]); // how much sanity you lose every turn when alone, always 3 until wood 1 SanityLossGroup = int.Parse(inputs[1]); // how much sanity you lose every turn when near another player, always 1 until wood 1 WandererSpawnTime = int.Parse(inputs[2]); // how many turns the wanderer take to spawn, always 3 until wood 1 WandererLifeTime = int.Parse(inputs[3]); // how many turns the wanderer is on map after spawning, always 40 until wood 1 }