public virtual void run() { TanksClient client = new TanksClient("http://10.12.202.144:9999/tournaments", "/sandbox-5", "JoyfulMistyRoseRailRaven"); while (true) { GameSetup gameSetup; try { Console.WriteLine("setup before"); //log.info("Waiting for the next game..."); gameSetup = client.MyGameSetup(); } catch (Exception ex) { Console.WriteLine(ex.Message); continue; } Console.WriteLine("setup ok"); //log.info("Playing {}", gameSetup); PlayGame(gameSetup, client); Console.WriteLine("next game started"); } }
private void PlayGame(GameSetup gameSetup, TanksClient client) { bool gameFinished = false; while (!gameFinished) { TurnResult result = client.SubmitMove(GenerateCommand(gameSetup)); gameFinished = result.last; } Console.WriteLine("game finished"); }
public virtual void Run() { TanksClient client = new TanksClient(Url, TournamentId, AccessToken); while (true) { Console.WriteLine("Waiting for the next game..."); var gameSetup = client.GetMyGameSetup(); Console.WriteLine(gameSetup); PlayGame(gameSetup, client); } }