Author: Scott Gasch
Date: 21:08:03 07/02/04
Go up one level in this thread
What move you are on in the game doesn't make any difference. Say your search (or qsearch, if it knows how to detect mates) has found a checkmate. Let's also say that you're at ply 8 (i.e. 8 moves from the root of the search). The score your search is returning is -MATE + 8. Mate in 8 plys from the root. Now you want to hash that. Instead of storing -MATE + 8 in the hash you store -MATE. This position is mate. Here and now. You're dead. If you find this position again in a search you don't care that it was 8 ply in that you first found it. Next your search returns -MATE + 8 as a score. Let's say you do negamax which means the next level of recursion busy searching the position above the mate (7 plies from the root) gets a score of +MATE - 8 back. Now it wants to store that in the hash. Again, +MATE - 8 is relative to the root of the search. You don't want to store that. You want to store +MATE - 1 (mate 1 ply from here). And again on up the line. If you have a mate in 8 ply from the root and you're storing it at ply 3 you want to store a "mate in 5 moves from here". Now when you look up in the hash and get a mate score back (whether it's on this same search in the game or on another one, it doesn't matter) you have to readjust again. When you hit a mate score you know the current distance from root (ply) where you got the hash hit and you know the distance from here that the mate is. Add the two together to make the score back into "distance from root"
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.