Esempio n. 1
0
        static TicTacToeGameState CreateNewGame(Random random, int startingPlayer = -1)
        {
            TicTacToeGameState state = new TicTacToeGameState();

            state.SetCurrentPlayer(startingPlayer == -1 ? random.Next(2) : startingPlayer);
            return(state);
        }
Esempio n. 2
0
        public IGameState <TicTacToePlay> Clone()
        {
            TicTacToeGameState newState = new TicTacToeGameState();

            for (int row = 0; row < 3; row++)
            {
                for (int col = 0; col < 3; col++)
                {
                    newState._board[row][col] = _board[row][col];
                }
            }
            newState._random           = _random;
            newState._freeCells        = _freeCells;
            newState._gameWon          = _gameWon;
            newState._winner           = _winner;
            newState.CurrentPlayerTurn = CurrentPlayerTurn;
            return(newState);
        }