Mate scores from IID

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Mate scores from IID

Post by ZirconiumX »

I was looking through the Stockfish source code, and noticed that it simply discards the search result. Which, to be fair, seems to be the common thing to do.

But say you get a mate score from IID. Since you're searching with the same window, the score should still be valid, right? So wouldn't it make sense to simply cutoff from this instead of going for a full depth search?
Some believe in the almighty dollar.

I believe in the almighty printf statement.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Mate scores from IID

Post by Dann Corbit »

ZirconiumX wrote:I was looking through the Stockfish source code, and noticed that it simply discards the search result. Which, to be fair, seems to be the common thing to do.

But say you get a mate score from IID. Since you're searching with the same window, the score should still be valid, right? So wouldn't it make sense to simply cutoff from this instead of going for a full depth search?
It's already in the hash table. I guess the real search will find it in a snap
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Mate scores from IID

Post by hgm »

But the IID result will not have enough depth to satisfy the real search. Unless you correct the draft of mate scores you are certain of to infinite. And you should do that on probing when you use the draft for a depth-preferred replacement scheme, or the whole table would be poisoned with mate scores.

But it should be safe to correct the draft of a mate-in-N score to infinity when it originally was >= 2*N-1, before you compare it with the requested depth.
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: Mate scores from IID

Post by ZirconiumX »

Dann Corbit wrote:
ZirconiumX wrote:I was looking through the Stockfish source code, and noticed that it simply discards the search result. Which, to be fair, seems to be the common thing to do.

But say you get a mate score from IID. Since you're searching with the same window, the score should still be valid, right? So wouldn't it make sense to simply cutoff from this instead of going for a full depth search?
It's already in the hash table. I guess the real search will find it in a snap
Perhaps so, but the cutoff will still save effort of things like evaluations, pruning and search stack setup. It probably won't save much effort, but it should still be worth something.
Some believe in the almighty dollar.

I believe in the almighty printf statement.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Mate scores from IID

Post by hgm »

The IID search should have already done these things, or you would also waste that effort every time IID does not return a mate score.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Mate scores from IID

Post by jdart »

I set an EXACT flag in the node structure when a search returns an exact score, including mate, stalemate, tablebase hit.

IID searches that return with this flag set return a score immediately and don't search further.

--Jon