build/ludorum.js
/** The core `maxN(game, player, depth)` algorithm return the evaluations for each player of the 
	given game, assuming each player tries to maximize its own evaluation regardless of the others'.
	*/
The core `maxN(game, player, depth)` algorithm return the evaluations for each player of the
given game, assuming each player tries to maximize its own evaluation regardless of the others'.
The core ` maxN ( game player depth ) ` algorithm return the evaluations for each player of the given game assuming each player tries to maximize its own evaluation regardless of the others ' .
function maxN(game, player, depth) {
		var values = this.quiescence(game, player, depth);
		if (!values) { 
			var activePlayer = game.activePlayer(),
				moves = this.movesFor(game, activePlayer),
				otherValues, next;
			values = {};
			if (moves.length < 1) {
				throw new Error('No moves for unfinished game '+ game +'.');
			}
			for (var i = 0; i < moves.length; ++i) {
				next = game.next(obj(activePlayer, moves[i]));
				otherValues = this.maxN(next, player, depth + 1);
				if (otherValues[activePlayer] > (values[activePlayer] || -Infinity)) {
					values = otherValues;
				}
			}
		}
		return values;
	}
function maxN ( game , player , depth ) { var values = this . quiescence ( game , player , depth ) ; if ( ! values ) { var activePlayer = game . activePlayer ( ) , moves = this . movesFor ( game , activePlayer ) , otherValues , next ; values = { } ; if ( moves . length < 1 ) { throw new Error ( 'No moves for unfinished game ' + game + '.' ) ; } for ( var i = 0 ; i < moves . length ; ++ i ) { next = game . next ( obj ( activePlayer , moves [ i ] ) ) ; otherValues = this . maxN ( next , player , depth + 1 ) ; if ( otherValues [ activePlayer ] > ( values [ activePlayer ] || - Infinity ) ) { values = otherValues ; } } } return values ; }
The core `maxN(game, player, depth)` algorithm return the evaluations for each player of the
given game, assuming each player tries to maximize its own evaluation regardless of the others'.
The core ` maxN ( game player depth ) ` algorithm return the evaluations for each player of the given game assuming each player tries to maximize its own evaluation regardless of the others ' .
// game is not quiescent.