private void RunGameVsAI() { var game = _gameFactory.NewGame(); Player player = default(Player); IArtificialIntelligence ai = null; switch (GetUserCommand(PlayerSelectMenu.Menu)) { case PlayerSelectMenu.PlayAsX: player = Player.X; break; case PlayerSelectMenu.PlayAsO: player = Player.O; break; case UIMenu.Quit: return; } switch (GetUserCommand(AIMenu.Menu)) { case AIMenu.BruteForce: ai = _gameFactory.NewArtificialIntelligence(ArtificialIntelligenceTypes.BruteForce); break; case AIMenu.OmniscientGod: //because some people were whining about it... if (_databaseBuilder.DatabaseIsEmpty()) { Populate(); } ai = _gameFactory.NewArtificialIntelligence(ArtificialIntelligenceTypes.OmniscientGod); break; case UIMenu.Quit: return; } while (game.GameIsOver == false) { if (player == game.CurrentPlayer) { MakeHumanMove(game); } else { ai.MakeMove(game); } } RenderGameOver(game); }