by H.G.Muller » 21 Feb 2007, 17:04
Exact draft doesn't solve the path-dependence, although it might be good for removing most other search instability. Performs worse, though, as it avoids the instability by passing back results that are already known to be wrong, just to maintain the appearance of consistency.
Like you say, path-specific hashing nearly completely destroys the usefulness of hashing. So the next-best thing you can do is hash the score that is most generally useful. And that is the score the node would have with the path-history completely cleared, like the 3-fold repetition rule did not exist. Note that this is theoretically completely sound: draws would still be draws if the 3-fold repetition rule would be replaced by any N-fold repetition rule, which could be effectively removed by taking N towards infinity.
It is just that at finite search depth, pure minimax fails to recognize branchess that make no progress. (This holds as much for branchess where you are constantly checked, but have so much lattitude in manoeuvring that that you never get any repetitions within the horizon. They can't be reduced to a quiet position within a resonable number of moves.)
So you should forget about the 3-fold rep rule, and focus on the search recognizing nodes from which no progress is possible to a position where the static evaluation is meaningful. The PV returning to a position occurring earlier in the path is a strong hint that the eval, or any prior result from a less deep search (not enough to span the depth between the two occurrences) cannot be trusted at all, but should be in fact replaced by a draw score.
But it should not be replaced by a draw score because it happened to occur in the path before. It should only be scored a draw if a return to this position is forced, in the sense that attempts to break out of the repetition for either side leads to scores that are worse for them than the draw score. For such positions, you should substitute the draw score for the evaluation or for a finite-depth search score. And for such positions that is not contamination at all, so you can safely store that draw score in the hash.
This is why I trigger on the third tree repetition only: between the first and the second occurrence the search goes for the best eval. The fact that it hits a repetition gives it a hint that the eval might not be reliable. So it redoes the search (in practice starting from the second occurrence, but they are identical anyway), now based on the assumption that the score of this node will be a draw when it returns to it.
Now if that still makes it the best option for both sides, it really is a draw. But it is quite possible that the side that has the advantage can break out of the repetition by sacrificing some material, and still be better off as with a draw (but worse than with the eval of the repeating position). That would then become the new PV after re-evaluation of the third repetition node as a draw. And this would lead to a score of the second occurrence different from both a draw and the evaluation. That score goes in the hash table. This now should be the same score as the first occurrence will receive, but you return it at the level of the second to allow it to properly affect the scores of the intervening nodes.
This really keeps the hash completely free of path-dependence.