Example #1
0
        /// <summary>
        /// Game played by our AI
        /// </summary>
        private static Game PlayGame(Game game)
        {
            //Create a callback to get the current game state each 100ms
            Timer timer = new Timer(WatchGame, playerKey, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(100));

            while (game.Status != GameStatus.FINISHED)
            {
                lastAction = GameBusiness.PlayAndWaitCoolDown(game.Token, playerKey, nextAction);

                game = GameBusiness.GetGame(game.Token, playerKey);
                Console.WriteLine("Me: " + game.Me.HealthPoints + "pv, foe: " + game.Foe.HealthPoints + "pv.");
            }

            timer.Dispose();

            return(game);
        }