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);
 }
        public bool TakeComputerTurn(NimPlayer comp)
        {
            int row         = 0;
            int numToRemove = 0;

            if (turn == Player.Player2) // computer 2 uses the learning system
            {
                Move move = comp.MakeMove(_rows);
                row         = move.Row;
                numToRemove = move.NumToRemove;
            }
            else  // computer 1 doesn't use the learning ai
            {
                Move move = comp.MakeMove(_rows);
                row         = move.Row;
                numToRemove = move.NumToRemove;
                //row = comp.MakeRowChoice(_rows.Count(), _rows);
                //numToRemove = comp.MakeRandomChoice(_rows[row - 1].RowSize);
            }
            Console.WriteLine("Computer " + turn + " takes " + numToRemove + " from row " + row);
            bool isGameOver = MakeMove(row, numToRemove);

            return(isGameOver);
        }