Пример #1
0
        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");
            }
        }
Пример #2
0
        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");
        }
Пример #3
0
        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);
            }
        }