public void PlayGame() { turn = Player.Player1; bool keepPlaying = true; player1 = new RandomAI(); player2 = new SmartAI(); numComputerPlayers = ChooseGameMode(); while (keepPlaying) { _rows = new Row[] { new Row(row1Size), new Row(row2Size), new Row(row3Size) }; bool isGameOver = false; while (!isGameOver) { printBoard(); isGameOver = TakeTurn(numComputerPlayers); // set to one human vs comp } Console.WriteLine("enter 0 to Quit, or anything else to play again"); string input = Console.ReadLine(); if (input.Equals("0")) { keepPlaying = false; // exits game Console.WriteLine("Comp1 bad states"); player1.PrintKnownMoves(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Comp2 bad states"); player2.PrintKnownMoves(); } } }
public void RandomVsLearningAI(int playTimes) { turn = Player.Player1; player1 = new SmartAI(); player2 = new SmartAI(); numComputerPlayers = 2; for (int j = 0; j < playTimes; ++j) { _rows = new Row[] { new Row(row1Size), new Row(row2Size), new Row(row3Size) }; bool isGameOver = false; while (!isGameOver) { printBoard(); isGameOver = TakeTurn(numComputerPlayers); } } Console.WriteLine("Comp1 bad states"); player1.PrintKnownMoves(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Comp2 bad states"); player2.PrintKnownMoves(); Console.WriteLine("Player1 wins: " + player1Wins + " Player2 wins: " + player2Wins); }