Esempio n. 1
0
    // Does the move for this board in a specific column.
    // If this returns true, the move resulted in a win and we should stop constructing the board deeper than this point
    public bool DoMove(int column)
    {
        if (!ConnectFour.IsPlayerValid(move.playerId))
        {
            Debug.LogError("BoardState : Set valid playerId first!");
            return(false);
        }

        move.column = column;
        board.Drop(move.playerId, column, out move.row);
        UpdateScore();

        // Return true if the column is now occupied, or the move won, or if it was a stalemate
        return(board.IsSpaceOccupied(column, 0) || board.CheckForWinIncremental(move.playerId, move.coord) || board.CheckForStalemate());
    }