TT score

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

TT score

Post by metax »

Normally you only take the score from the TT (and then test if you can prune the branch safely) if the depth of the TT entry is greater than or equal the remaining depth. Would it be safe to ignore this condition if the score stored is a mate value since it would be useless to search that branch again (of course only if the alpha-beta bounds indicate that pruning is safe)?
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: TT score

Post by michiguel »

metax wrote:Normally you only take the score from the TT (and then test if you can prune the branch safely) if the depth of the TT entry is greater than or equal the remaining depth. Would it be safe to ignore this condition if the score stored is a mate value since it would be useless to search that branch again (of course only if the alpha-beta bounds indicate that pruning is safe)?
Yes, If I understood correctly. Once you find a mate score in a sub-branch, the score could become only better for the mating side (if your implementation of mates is bug free). So, the score could be mate or better, no matter how deeper you search. There is no point in searching deeper if a mater score will suffice to cut off.

Miguel
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: TT score

Post by hgm »

indeed, mate scores are valid to any depth. At one point I stored them with infinite depth in the hash table, but that was a bad idea when I used the depth to make replacement decisions. very rapidly the hash table was completely poisoned with mate scores, leaving no room for other entries...
zamar
Posts: 613
Joined: Sun Jan 18, 2009 7:03 am

Re: TT score

Post by zamar »

metax wrote:Normally you only take the score from the TT (and then test if you can prune the branch safely) if the depth of the TT entry is greater than or equal the remaining depth. Would it be safe to ignore this condition if the score stored is a mate value since it would be useless to search that branch again (of course only if the alpha-beta bounds indicate that pruning is safe)?
Stockfish does this.
Joona Kiiski
metax
Posts: 344
Joined: Wed Sep 23, 2009 5:56 pm
Location: Germany

Re: TT score

Post by metax »

hgm wrote:indeed, mate scores are valid to any depth. At one point I stored them with infinite depth in the hash table, but that was a bad idea when I used the depth to make replacement decisions. very rapidly the hash table was completely poisoned with mate scores, leaving no room for other entries...
It is simple to add a condition for the score itself anyway. You can simply use "if (entry->Depth >= depth || IsMateScore(entry->Score))" instead of only "if (entry->Depth >= depth)" which is much simpler than playing around with infinite depths.

Just waned to know if this is safe, but it seems so. Btw, is this the reason (together with Mate Distance Pruning) for Stockfish reaching depth 100 pretty quickly when it has found a (short) mate?
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: TT score

Post by hgm »

mate-distance pruning alone is enough for that. You will see the same in micro-Max. (Except that I limited the depth to 28 there, for no real reason.)

Joker does not even deepen beyond 2N-1 ply when it finds a mate-in-N, so you would never see it go to 100.