src/players/MiniMaxPlayer.js
/** A `solution` calculates the minimax value for every game state derivable from the given 
	`game`. The result is an object with a key for every game state, with a numerical value. The
	game is assumed to be deterministic.
	
	The optional `options` argument can have:

	+ `gameKey`: A function that returns a string key for every game state. The game `toString` 
	method is used by default.

	+ `evals`: The object in which the solution is stored. A new object is used by default.
	*/
A `solution` calculates the minimax value for every game state derivable from the given
`game`. The result is an object with a key for every game state, with a numerical value. The
game is assumed to be deterministic.

The optional `options` argument can have.

+ `gameKey`: A function that returns a string key for every game state. The game `toString`
method is used by default.

+ `evals`: The object in which the solution is stored. A new object is used by default.
A ` solution ` calculates the minimax value for every game state derivable from the given ` game ` . The result is an object with a key for every game state with a numerical value . The game is assumed to be deterministic . The optional ` options ` argument can have . + ` gameKey ` : A function that returns a string key for every game state . The game ` toString ` method is used by default . + ` evals ` : The object in which the solution is stored . A new object is used by default .
function solution(game, options) {
		var evals = options && options.evals || {},
			mmPlayer = new this({ horizon: 1e8 }),
			gameKey = options.gameKey || function (game) {
				return game.toString();
			};
		mmPlayer.minimax(game, game.activePlayer(), 0, { 
			hook: function (game, value) {
				var k = gameKey(game);
				raiseIf(evals.hasOwnProperty(k) && evals[k] !== value, "Game ", game, "(key ", 
					k, ") has different values ", evals[k], " and ", value, "!");
				evals[k] = value;
			}
		});
		return evals;
	}
function solution ( game , options ) { var evals = options && options . evals || { } , mmPlayer = new this ( { horizon : 1e8 } ) , gameKey = options . gameKey || function ( game ) { return game . toString ( ) ; } ; mmPlayer . minimax ( game , game . activePlayer ( ) , 0 , { hook : function ( game , value ) { var k = gameKey ( game ) ; raiseIf ( evals . hasOwnProperty ( k ) && evals [ k ] !== value , "Game " , game , "(key " , k , ") has different values " , evals [ k ] , " and " , value , "!" ) ; evals [ k ] = value ; } } ) ; return evals ; }
A `solution` calculates the minimax value for every game state derivable from the given
`game`.
A ` solution ` calculates the minimax value for every game state derivable from the given ` game ` .