src/Game.js
/** The method `moves()` returns the available moves for each player. Yet this is not the same
	as the `moves` objects that can be used with `next()` to obtain a next game state. Furthermore,
	if there are more than one active player per turn, the possible decisions can be build with all
	combinations for all active players.

	The method `possibleMoves(moves=this.moves())` calculates all possible `moves` objects based on
	the result of `moves()`. For example, if `moves()` returns `{A:[1,2], B:[3,4]}`, then
	`possibleMoves()` would return `[{A:1, B:3}, {A:1, B:4}, {A:2, B:3}, {A:2, B:4}]`.
	*/
The method `moves()` returns the available moves for each player. Yet this is not the same
as the `moves` objects that can be used with `next()` to obtain a next game state. Furthermore,
if there are more than one active player per turn, the possible decisions can be build with all
combinations for all active players.


The method ` moves () ` returns the available moves for each player . Yet this is not the same as the ` moves ` objects that can be used with ` next () ` to obtain a next game state . Furthermore if there are more than one active player per turn the possible decisions can be build with all combinations for all active players .
function possibleMoves(moves) {
		moves = arguments.length < 1 ? this.moves() : moves;
		if (!moves || typeof moves !== 'object') {
			return [];
		}
		var activePlayers = Object.keys(moves);
		if (activePlayers.length === 1) { 
			var activePlayer = activePlayers[0];
			return moves[activePlayer].map(function (move) {
				return obj(activePlayer, move);
			});
		} else { 
			return Iterable.product.apply(Iterable,
				iterable(moves).mapApply(function (player, moves) {
					return moves.map(function (move) {
						return [player, move];
					});
				}).toArray()
			).map(function (playerMoves) {
				return iterable(playerMoves).toObject();
			}).toArray();
		}
	}
function possibleMoves ( moves ) { moves = arguments . length < 1 ? this . moves ( ) : moves ; if ( ! moves || typeof moves !== 'object' ) { return [ ] ; } var activePlayers = Object . keys ( moves ) ; if ( activePlayers . length === 1 ) { var activePlayer = activePlayers [ 0 ] ; return moves [ activePlayer ] . map ( function ( move ) { return obj ( activePlayer , move ) ; } ) ; } else { return Iterable . product . apply ( Iterable , iterable ( moves ) . mapApply ( function ( player , moves ) { return moves . map ( function ( move ) { return [ player , move ] ; } ) ; } ) . toArray ( ) ) . map ( function ( playerMoves ) { return iterable ( playerMoves ) . toObject ( ) ; } ) . toArray ( ) ; } }
The method `moves()` returns the available moves for each player.
The method ` moves () ` returns the available moves for each player .
// Most common case. // Simultaneous games.