Mate score from the transposition table

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Mate score from the transposition table

Post by Evert »

Quick question.

I probe the transposition table, and get an entry back. Sadly, the depth is lower than the remaining search depth, so I can't take the cut-off. I salvage what I can from the entry (whatever move it says I should search first, maybe I do something with the information that it was an ALL node last time it was searched, maybe I disable the NULL move) and do a normal search.

Now suppose that the score that was returned from the table is a mate score. Can I simply ignore the stored depth in that case? I mean, it's not like a remaining depth of 10 ever makes sense for a position that is mate-in-four. A different way of asking the same question is: can I simply store a mate position with "infinite" remaining depth?
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: Mate score from the transposition table

Post by Rein Halbersma »

Evert wrote:Quick question.

I probe the transposition table, and get an entry back. Sadly, the depth is lower than the remaining search depth, so I can't take the cut-off. I salvage what I can from the entry (whatever move it says I should search first, maybe I do something with the information that it was an ALL node last time it was searched, maybe I disable the NULL move) and do a normal search.

Now suppose that the score that was returned from the table is a mate score. Can I simply ignore the stored depth in that case? I mean, it's not like a remaining depth of 10 ever makes sense for a position that is mate-in-four. A different way of asking the same question is: can I simply store a mate position with "infinite" remaining depth?
It should always be save (not cost game points), since mate is not a heuristic score that could improve at greater depth. If your mate scores are depth encoded (M1 > M2 etc.), then it should even be efficient (find the fastest win) because if you already know you are winning, a slower win will fall outside the search window. Grafting issues ignored of course.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Mate score from the transposition table

Post by hgm »

You should be careful with that. Matescores can improve with search depth, due to grafting and reductions. Even when you search 11 ply there is no guarantee you would have seen ever mate faster than mate in 6, and it can very well be that the mate in 4 is only found at 15 ply, if it starts with 3 quiet (heavily reduced) moves. So the M6 score at 11 ply was not valid to infinite depth.

It will of course be a valid lower bound to the score, so if you could achieve a cutoff with it, you would not have to worry about depth.

Be careful to not upgrade the depth in what you store, but take the decision when you probe. Or it would wreck your depth-preferred replacement, which would start to protect relatively easy to obtain search results at the expense of very deep searches.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Mate score from the transposition table

Post by bob »

Evert wrote:Quick question.

I probe the transposition table, and get an entry back. Sadly, the depth is lower than the remaining search depth, so I can't take the cut-off. I salvage what I can from the entry (whatever move it says I should search first, maybe I do something with the information that it was an ALL node last time it was searched, maybe I disable the NULL move) and do a normal search.

Now suppose that the score that was returned from the table is a mate score. Can I simply ignore the stored depth in that case? I mean, it's not like a remaining depth of 10 ever makes sense for a position that is mate-in-four. A different way of asking the same question is: can I simply store a mate position with "infinite" remaining depth?
A mate ought to be good, period. Depth of the entry should not matter. The only issue is that this will not always let you find the shortest mate due to the way extensions work.