@Override
protected TwoPlayerMove searchInternal( TwoPlayerMove lastMove,
int depth,
SearchWindow window, SearchTreeNode parent ) {
HashKey key = searchable.getHashKey();
Entry entry = lookupTable.get(key);
if (lookupTable.entryExists(entry, lastMove, depth, window)) {
if (entry.lowerValue > window.alpha) {
entry.bestMove.setInheritedValue(entry.lowerValue);
return entry.bestMove;
}
else if (entry.upperValue < window.beta) {
entry.bestMove.setInheritedValue(entry.upperValue);
return entry.bestMove;
}
}
entry = new Entry(lastMove, depth, new SearchWindow(-INFINITY, INFINITY));
boolean done = searchable.done( lastMove, false);
if ( depth <= 0 || done ) {
if (doQuiescentSearch(depth, done, lastMove)) {
TwoPlayerMove qMove = quiescentSearch(lastMove, depth, window, parent);
if (qMove != null) {
entry = new Entry(qMove, qMove.getInheritedValue());
lookupTable.put(key, entry);
return qMove;
}
}
int sign = fromPlayer1sPerspective(lastMove) ? 1 : -1;