tests/lib/ludorum.js
/** An entry's `descendant(entry, moves)` is the entry of the game state 
	following the given entry's game state with the given moves. The method not
	only returns the entry is this state, it creates and caches that entry if 
	not present.
	*/
An entry's `descendant(entry, moves)` is the entry of the game state
following the given entry's game state with the given moves. The method not
only returns the entry is this state, it creates and caches that entry if
not present.
An entry ' s ` descendant ( entry moves ) ` is the entry of the game state following the given entry ' s game state with the given moves . The method not only returns the entry is this state it creates and caches that entry if not present .
function descendant(entry, moves) {
		var movesId = this.moveIdentifier(moves),
			descendants = entry.descendants;
		if (descendants.hasOwnProperty(movesId)) { 
			return descendants[movesId][1];
		} else {
			var nextState = entry.state.next(moves),
				nextStateId = this.stateIdentifier(nextState),
				nextEntry = this.get(nextStateId) || 
					this.entry(nextState, nextStateId); 
			descendants[movesId] = [moves, nextEntry];
			nextEntry.precursors.push([moves, entry]);
			return nextEntry;
		}
	}
function descendant ( entry , moves ) { var movesId = this . moveIdentifier ( moves ) , descendants = entry . descendants ; if ( descendants . hasOwnProperty ( movesId ) ) { return descendants [ movesId ] [ 1 ] ; } else { var nextState = entry . state . next ( moves ) , nextStateId = this . stateIdentifier ( nextState ) , nextEntry = this . get ( nextStateId ) || this . entry ( nextState , nextStateId ) ; descendants [ movesId ] = [ moves , nextEntry ] ; nextEntry . precursors . push ( [ moves , entry ] ) ; return nextEntry ; } }
An entry's `descendant(entry, moves)` is the entry of the game state
following the given entry's game state with the given moves.
An entry ' s ` descendant ( entry moves ) ` is the entry of the game state following the given entry ' s game state with the given moves .
// Already expanded. // Reuse entry in cache if it exists. // Else add new entry.