Depth in quiescence TT storing

Discussion of chess software programming and technical issues.

Moderator: Ras

jackk03
Posts: 18
Joined: Wed Jul 12, 2023 1:38 pm
Full name: Giacomo Porpiglia

Depth in quiescence TT storing

Post by jackk03 »

Hello,
I was recently reviewing my quiescence code, and saw that when I store a position in TT from quiescence, I use depth=0 as depth stored in TT.
I see basically all other engines do that as well.
But could it be possible to store them with "negative depth", that lowers by 1 each time we call quiescence recursively (just like in classical search function) so that the leaves of the quiescence have less priority than the roots in the TT?
User avatar
lithander
Posts: 915
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Depth in quiescence TT storing

Post by lithander »

Leorik doesn't use TT in QSearch but if I would use it I'd store results like all the other engines: with depth 0.

That is because the result of QSearch is deterministic and doesn't get better the deeper you q-search. Instead you always search as deep as it takes to quiesce the position. After X recursive calls all check evasions and captures have been played and the score you propagate up is the 'real' value of all prior positions on the stack until you get back into "normal" depth limited search. When all QSearch values are the same "quality" you can store them in the TT with the same depth wich is not 1 and not "worse" then 0 and so it must be 0.
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
jackk03
Posts: 18
Joined: Wed Jul 12, 2023 1:38 pm
Full name: Giacomo Porpiglia

Re: Depth in quiescence TT storing

Post by jackk03 »

That makes sense, I didn't think about it that way. Thanks :)