build/ludorum.js
/** An `HeuristicPlayer` choses the best moves at any given game state. For this purpose it 
	evaluates every move with `moveEvaluation(move, game, player)`. By default this function 
	evaluates the states resulting from making each move, which is the most common thing to do.
	*/
An `HeuristicPlayer` choses the best moves at any given game state. For this purpose it
evaluates every move with `moveEvaluation(move, game, player)`. By default this function
evaluates the states resulting from making each move, which is the most common thing to do.
An ` HeuristicPlayer ` choses the best moves at any given game state . For this purpose it evaluates every move with ` moveEvaluation ( move game player ) ` . By default this function evaluates the states resulting from making each move which is the most common thing to do .
function moveEvaluation(move, game, player) {
		var heuristicPlayer = this;
		if (Object.keys(move).length < 2) { 
			return this.stateEvaluation(game.next(move), player);
		} else { 
			var sum = 0, count = 0;
			move = copy(obj(player, [move[player]]), move);
			game.possibleMoves(move).forEach(function (ms) {
				sum += heuristicPlayer.stateEvaluation(game.next(ms), player);
				++count;
			});
			return count > 0 ? sum / count : 0; 
		}
	}
function moveEvaluation ( move , game , player ) { var heuristicPlayer = this ; if ( Object . keys ( move ) . length < 2 ) { return this . stateEvaluation ( game . next ( move ) , player ) ; } else { var sum = 0 , count = 0 ; move = copy ( obj ( player , [ move [ player ] ] ) , move ) ; game . possibleMoves ( move ) . forEach ( function ( ms ) { sum += heuristicPlayer . stateEvaluation ( game . next ( ms ) , player ) ; ++ count ; } ) ; return count > 0 ? sum / count : 0 ; } }
An `HeuristicPlayer` choses the best moves at any given game state.
An ` HeuristicPlayer ` choses the best moves at any given game state .
// One active player. // Many active players. // Average all evaluations.