clone()
    {
        var newBoard = new Board(this.#rows, this.#cols, this.#winSequence);

        newBoard.#whiteMoves = this.#whiteMoves;
        newBoard.#totalMoves = this.#totalMoves;
        newBoard.#turnsRemaining = this.#turnsRemaining;
        newBoard.gameLog = this.gameLog.slice();
        newBoard.outcome = this.outcome;

        //clone the board itself
        newBoard.board = new Array(this.#rows);       
        for (let r = 0; r < this.#rows; r++) 
        {
            newBoard.board[r] = new Array(this.#cols);
            for (let c = 0; c < this.#cols; c++)
                newBoard.board[r][c] = this.board[r][c];
        }

        return newBoard;
    }
/**
     * Returns a new board with an identical context.
     */
Returns a new board with an identical context.
Returns a new board with an identical context .
clone()
    {
        var newBoard = new Board(this.#rows, this.#cols, this.#winSequence);
        newBoard.#whiteMoves = this.#whiteMoves;
        newBoard.#totalMoves = this.#totalMoves;
        newBoard.#turnsRemaining = this.#turnsRemaining;
        newBoard.gameLog = this.gameLog.slice();
        newBoard.outcome = this.outcome;
        newBoard.board = new Array(this.#rows);       
        for (let r = 0; r < this.#rows; r++) 
        {
            newBoard.board[r] = new Array(this.#cols);
            for (let c = 0; c < this.#cols; c++)
                newBoard.board[r][c] = this.board[r][c];
        }
        return newBoard;
    }
clone ( ) { var newBoard = new Board ( this . #rows , this . #cols , this . #winSequence ) ; newBoard . #whiteMoves = this . #whiteMoves ; newBoard . #totalMoves = this . #totalMoves ; newBoard . #turnsRemaining = this . #turnsRemaining ; newBoard . gameLog = this . gameLog . slice ( ) ; newBoard . outcome = this . outcome ; newBoard . board = new Array ( this . #rows ) ; for ( let r = 0 ; r < this . #rows ; r ++ ) { newBoard . board [ r ] = new Array ( this . #cols ) ; for ( let c = 0 ; c < this . #cols ; c ++ ) newBoard . board [ r ] [ c ] = this . board [ r ] [ c ] ; } return newBoard ; }
Returns a new board with an identical context.
Returns a new board with an identical context .
//clone the board itself
