assessment()
    {
        // return a quick result if it's game over
        if (this.outcome != ONGOING)
            return this.outcome;

        var remainingWhite = this.getTurnsRemaining(true);
        var remainingBlack = this.getTurnsRemaining(false);
        var totalTurns = this.#cols * this.#rows;
        var turnsTaken = totalTurns - this.#turnsRemaining;
        var whitePoints = 0;
        var blackPoints = 0;

        for (let r = 0; r < this.#rows; r++) 
            for (let c = 0; c < this.#cols; c++)
            {
                let {whites, blacks, empties} = this.getNeighbors(r,c);
                let points = 0;

                if (r < this.#rows / 2)
                    points += r;
                else 
                    points += this.#rows - r;
                
                if (c < this.#cols / 2)
                    points += c;
                else 
                    points += this.#cols - c;
            
                if (this.board[r][c] === WHITE)
                {
                    whitePoints += points + whites - blacks;
                    
                }   
                else if (this.board[r][c] === BLACK)
                {
                    blackPoints += points + blacks - whites;
                }  
            }

        // adjust the advantage based on who has more turns to go
        let advantageFactor = (1 / this.#turnsRemaining);

        if (remainingBlack > remainingWhite)
            blackPoints *= (1 + advantageFactor);
        else if (remainingWhite > remainingBlack)
            whitePoints *= (1 + advantageFactor);
        else //same number of moves remaining
        {
            // give a slight first-movers advantage
            if (this.#whiteMoves)
                whitePoints *= (1 + advantageFactor / 3);
            else
                blackPoints *= (1 + advantageFactor / 3);
        }
        
        // go through all sequences of length 2 until (but lower than) winSequence
        for (let i = this.#winSequence - 1; i >= 2; i--)
        {
            whitePoints += Math.pow(this.#findAllSeq(true, i), 3);
            blackPoints += Math.pow(this.#findAllSeq(false, i), 3);
        }

        return whitePoints - blackPoints;
    }
/**
     * Returns a value denoting whose board position is stronger (white/black).
     * A higher positive number is better for white. A lower negative number is better for black.
     * 
     * BLACK_WIN = black wins
     * 0 = balanced position or draw.
     * WHITE_WIN = white wins
     */
Returns a value denoting whose board position is stronger (white/black).
A higher positive number is better for white. A lower negative number is better for black.

BLACK_WIN = black wins
0 = balanced position or draw.
WHITE_WIN = white wins
Returns a value denoting whose board position is stronger ( white / black ) . A higher positive number is better for white . A lower negative number is better for black . BLACK_WIN = black wins 0 = balanced position or draw . WHITE_WIN = white wins
assessment()
    {
        if (this.outcome != ONGOING)
            return this.outcome;
        var remainingWhite = this.getTurnsRemaining(true);
        var remainingBlack = this.getTurnsRemaining(false);
        var totalTurns = this.#cols * this.#rows;
        var turnsTaken = totalTurns - this.#turnsRemaining;
        var whitePoints = 0;
        var blackPoints = 0;
        for (let r = 0; r < this.#rows; r++) 
            for (let c = 0; c < this.#cols; c++)
            {
                let {whites, blacks, empties} = this.getNeighbors(r,c);
                let points = 0;
                if (r < this.#rows / 2)
                    points += r;
                else 
                    points += this.#rows - r;
                if (c < this.#cols / 2)
                    points += c;
                else 
                    points += this.#cols - c;
                if (this.board[r][c] === WHITE)
                {
                    whitePoints += points + whites - blacks;
                }   
                else if (this.board[r][c] === BLACK)
                {
                    blackPoints += points + blacks - whites;
                }  
            }
        let advantageFactor = (1 / this.#turnsRemaining);
        if (remainingBlack > remainingWhite)
            blackPoints *= (1 + advantageFactor);
        else if (remainingWhite > remainingBlack)
            whitePoints *= (1 + advantageFactor);
        else 
        {
            if (this.#whiteMoves)
                whitePoints *= (1 + advantageFactor / 3);
            else
                blackPoints *= (1 + advantageFactor / 3);
        }
        for (let i = this.#winSequence - 1; i >= 2; i--)
        {
            whitePoints += Math.pow(this.#findAllSeq(true, i), 3);
            blackPoints += Math.pow(this.#findAllSeq(false, i), 3);
        }
        return whitePoints - blackPoints;
    }
assessment ( ) { if ( this . outcome != ONGOING ) return this . outcome ; var remainingWhite = this . getTurnsRemaining ( true ) ; var remainingBlack = this . getTurnsRemaining ( false ) ; var totalTurns = this . #cols * this . #rows ; var turnsTaken = totalTurns - this . #turnsRemaining ; var whitePoints = 0 ; var blackPoints = 0 ; for ( let r = 0 ; r < this . #rows ; r ++ ) for ( let c = 0 ; c < this . #cols ; c ++ ) { let { whites , blacks , empties } = this . getNeighbors ( r , c ) ; let points = 0 ; if ( r < this . #rows / 2 ) points += r ; else points += this . #rows - r ; if ( c < this . #cols / 2 ) points += c ; else points += this . #cols - c ; if ( this . board [ r ] [ c ] === WHITE ) { whitePoints += points + whites - blacks ; } else if ( this . board [ r ] [ c ] === BLACK ) { blackPoints += points + blacks - whites ; } } let advantageFactor = ( 1 / this . #turnsRemaining ) ; if ( remainingBlack > remainingWhite ) blackPoints *= ( 1 + advantageFactor ) ; else if ( remainingWhite > remainingBlack ) whitePoints *= ( 1 + advantageFactor ) ; else { if ( this . #whiteMoves ) whitePoints *= ( 1 + advantageFactor / 3 ) ; else blackPoints *= ( 1 + advantageFactor / 3 ) ; } for ( let i = this . #winSequence - 1 ; i >= 2 ; i -- ) { whitePoints += Math . pow ( this . #findAllSeq ( true , i ) , 3 ) ; blackPoints += Math . pow ( this . #findAllSeq ( false , i ) , 3 ) ; } return whitePoints - blackPoints ; }
Returns a value denoting whose board position is stronger (white/black).
Returns a value denoting whose board position is stronger ( white / black ) .
// return a quick result if it's game over
 // adjust the advantage based on who has more turns to go
 //same number of moves remaining
 // give a slight first-movers advantage
 // go through all sequences of length 2 until (but lower than) winSequence
