Code: Select all
// In the search function
if (CURRENT_POS_IS_IN_TABLE && CURRENT_POS_WAS_SEARCHED_ENOUGH_DEPTH ) {
if ( node.hasExactScore ) {
temp = node.value
} else if ( node.Failed_High ) {
temp = -searchToDepth( depth - 1, node.value, -alpha );
} else if ( node.Failed_Low ) {
temp = -searchToDepth( depth - 1, -beta, node.value );
}
}
Exact: The node was fully searched and didn't end because of a cutoff. The value returned can be re-used without any more search necessary.
Fail_High: The node searched produced a value that was too high for the beta so the search of that node was terminated. The returned value can be used as a lower bound because we know that a re-search of this node will produce a value at least as good as this.
Fail_Low: The node searched did not ever manage to beat the given alpha score. The value returned can be used as an upper bound because a re-search of this position will never produce a value better than this one.