build/ludorum.js
/** `evaluatedMoves(game, player)` returns a sequence with the evaluated moves.
	*/
`evaluatedMoves(game, player)` returns a sequence with the evaluated moves.
` evaluatedMoves ( game player ) ` returns a sequence with the evaluated moves .
function evaluatedMoves(game, player) {
		raiseIf(game.isContingent, "MonteCarloPlayer cannot evaluate root contingent states!"); 
		var monteCarloPlayer = this,
			startTime = Date.now(),
			options = this.possibleMoves(game, player).map(function (move) {
				return {
					move: move,
					nexts: (Object.keys(move).length < 2 ?
						[game.next(move)] :
						game.possibleMoves(copy(obj(player, [move[player]]), move)).map(function (moves) {
							return game.next(moves);
						})
					),
					sum: 0,
					count: 0
				};
			}); 
		for (var i = 0; !this.__finishMoveEvaluation__(i, startTime, options); ) {
			options.forEach(function (option) {
				option.nexts = option.nexts.filter(function (next) {
					var sim = monteCarloPlayer.simulation(next, player);
					option.sum += sim.result;
					++option.count;
					return sim.plies > 0;
				});
				i++;
			});
		}
		return options.map(function (option) {
			raiseIf(isNaN(option.sum), "State evaluation is NaN for move ", option.move, "!");
			return [option.move, option.count > 0 ? option.sum / option.count : 0, option.count];
		});
	}
function evaluatedMoves ( game , player ) { raiseIf ( game . isContingent , "MonteCarloPlayer cannot evaluate root contingent states!" ) ; var monteCarloPlayer = this , startTime = Date . now ( ) , options = this . possibleMoves ( game , player ) . map ( function ( move ) { return { move : move , nexts : ( Object . keys ( move ) . length < 2 ? [ game . next ( move ) ] : game . possibleMoves ( copy ( obj ( player , [ move [ player ] ] ) , move ) ) . map ( function ( moves ) { return game . next ( moves ) ; } ) ) , sum : 0 , count : 0 } ; } ) ; for ( var i = 0 ; ! this . __finishMoveEvaluation__ ( i , startTime , options ) ; ) { options . forEach ( function ( option ) { option . nexts = option . nexts . filter ( function ( next ) { var sim = monteCarloPlayer . simulation ( next , player ) ; option . sum += sim . result ; ++ option . count ; return sim . plies > 0 ; } ) ; i ++ ; } ) ; } return options . map ( function ( option ) { raiseIf ( isNaN ( option . sum ) , "State evaluation is NaN for move " , option . move , "!" ) ; return [ option . move , option . count > 0 ? option . sum / option . count : 0 , option . count ] ; } ) ; }
`evaluatedMoves(game, player)` returns a sequence with the evaluated moves.
` evaluatedMoves ( game player ) ` returns a sequence with the evaluated moves .
//FIXME // Else the following updates won't work.