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 whitePoints = 0;
		var blackPoints = 0;

		// assess points based on token position alone
		for (let r = 0; r < this.rows; r++)
			for (let c = 0; c < this.cols; 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;
				} else if (this.board[r][c] === BLACK) {
					blackPoints += points;
				}
			}

		// 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;

		// give a slight first-movers advantage
		if (this.whiteMoves) whitePoints *= 1 + advantageFactor / 2;
		else blackPoints *= 1 + advantageFactor / 2;

		// go through all sequences of length 1 until (but lower than) winSequence because game is ongoing
		for (let i = this.winSequence - 1; i >= 1; i--) {
			let whiteSeq = this.findAllSeq(true, i);
			let blackSeq = this.findAllSeq(false, i);
			if (i === this.winSequence - 1) {
				if (whiteSeq > 0 && this.whiteMoves) return WHITE_WIN - 1;
				if (blackSeq > 0 && !this.whiteMoves) return BLACK_WIN + 1;
			}
			whitePoints += whiteSeq * i * i * i;
			blackPoints += blackSeq * i * i * i;
		}

		let ret = whitePoints - blackPoints;

		return ret;
	}
/**
	 * 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 whitePoints = 0;
		var blackPoints = 0;
		for (let r = 0; r < this.rows; r++)
			for (let c = 0; c < this.cols; 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;
				} else if (this.board[r][c] === BLACK) {
					blackPoints += points;
				}
			}
		let advantageFactor = 1 / this.turnsRemaining;
		if (remainingBlack > remainingWhite) blackPoints *= 1 + advantageFactor;
		else if (remainingWhite > remainingBlack) whitePoints *= 1 + advantageFactor;
		if (this.whiteMoves) whitePoints *= 1 + advantageFactor / 2;
		else blackPoints *= 1 + advantageFactor / 2;
		for (let i = this.winSequence - 1; i >= 1; i--) {
			let whiteSeq = this.findAllSeq(true, i);
			let blackSeq = this.findAllSeq(false, i);
			if (i === this.winSequence - 1) {
				if (whiteSeq > 0 && this.whiteMoves) return WHITE_WIN - 1;
				if (blackSeq > 0 && !this.whiteMoves) return BLACK_WIN + 1;
			}
			whitePoints += whiteSeq * i * i * i;
			blackPoints += blackSeq * i * i * i;
		}
		let ret = whitePoints - blackPoints;
		return ret;
	}
assessment ( ) { if ( this . outcome !== ONGOING ) return this . outcome ; var remainingWhite = this . getTurnsRemaining ( true ) ; var remainingBlack = this . getTurnsRemaining ( false ) ; var whitePoints = 0 ; var blackPoints = 0 ; for ( let r = 0 ; r < this . rows ; r ++ ) for ( let c = 0 ; c < this . cols ; 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 ; } else if ( this . board [ r ] [ c ] === BLACK ) { blackPoints += points ; } } let advantageFactor = 1 / this . turnsRemaining ; if ( remainingBlack > remainingWhite ) blackPoints *= 1 + advantageFactor ; else if ( remainingWhite > remainingBlack ) whitePoints *= 1 + advantageFactor ; if ( this . whiteMoves ) whitePoints *= 1 + advantageFactor / 2 ; else blackPoints *= 1 + advantageFactor / 2 ; for ( let i = this . winSequence - 1 ; i >= 1 ; i -- ) { let whiteSeq = this . findAllSeq ( true , i ) ; let blackSeq = this . findAllSeq ( false , i ) ; if ( i === this . winSequence - 1 ) { if ( whiteSeq > 0 && this . whiteMoves ) return WHITE_WIN - 1 ; if ( blackSeq > 0 && ! this . whiteMoves ) return BLACK_WIN + 1 ; } whitePoints += whiteSeq * i * i * i ; blackPoints += blackSeq * i * i * i ; } let ret = whitePoints - blackPoints ; return ret ; }
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
 // assess points based on token position alone
 // adjust the advantage based on who has more turns to go
 // give a slight first-movers advantage
 // go through all sequences of length 1 until (but lower than) winSequence because game is ongoing
