Fail High nodes
Posted: Mon Jan 14, 2013 2:43 am
I am having trouble getting my transposition table to work right, manly in nodes that are not exact. Here's how I've been implementing it:
My program is making very poor moves with this code. If I leave out checking for Fail Highs, (i.e. I only store positions in the transposition table that failed low or have an exact score) then it works fine however. Correct me if I'm wrong, but here's how I see the three types of nodes:
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.
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.