/* Checks all the next possible moves given a Board. */
        WinState?CheckNextMoves(Board GameBoard)
        {
            // will be randomized from all possible moves
            int nextMove;

            // play a single move, then keep playing checking
            // every move to find the best ones
            while (!GameBoard.CheckForWinner())
            {
                List <int> possibleMoves = GameBoard.GetPossibleMoves();

                // choose a random move from the possible moves
                nextMove = rnd.Next(0, possibleMoves.Count);

                GameBoard.MakeMove(possibleMoves[nextMove]);
            }

            // return who would win the game
            return(GameBoard.Winner);
        }
Exemple #2
0
        /* Checks all the next possible moves given a Board. */
        WinState? CheckNextMoves(Board GameBoard)
        {
            // will be randomized from all possible moves
            int nextMove;

            // play a single move, then keep playing checking
            // every move to find the best ones
            while (!GameBoard.CheckForWinner())
            {
                List<int> possibleMoves = GameBoard.GetPossibleMoves();

                // choose a random move from the possible moves
                nextMove = rnd.Next(0, possibleMoves.Count);

                GameBoard.MakeMove(possibleMoves[nextMove]);
            }

            // return who would win the game
            return GameBoard.Winner;
        }