basil00 / Fathom

Syzygy TB probe tool.
MIT License
17 stars 26 forks source link

wrong DTZ returned #20

Closed DrRossJohnson closed 7 years ago

DrRossJohnson commented 7 years ago

The following FEN returns WDL=2 and DTZ=1, but taking the pawn (the only zeroing move) drops the queen and the win. Note that Qc1 yields a position that also returns DTZ=1, which forces the pawn move, so the given FEN should yield DTZ=2.

"8/8/8/8/8/1pQ1K3/k7/8 w - - 2 2"

DrRossJohnson commented 7 years ago

I just found out that there are some imprecise values coming out of the syzygy tables due to compression, so DTZ could be off by one. There is a lengthy discussion at http://www.talkchess.com/forum/viewtopic.php?t=58488 where creator Ronald de Man explains that DTZ=z (plies, not moves) is stored in the tables as integer (z+1)/2-1, except z=0 also maps to 0. Therefore, the the results from a table probe could be off by one. Since z=100 and z=101 map to different numbers, this is not a problem when the engine initially enters a table (ply count is zero), but Ronald also says there could be an issue if an opponent blunders a blessed-loss position and the engine misses the precise win by having a DTZ that is off by one.

Is there a way to more precisely search so that DTZ is always correct when using these tables?

basil00 commented 7 years ago

The best person to ask is Ronald de Man. Fathom is actually just an interface to Ronald's code, so I don't claim to be familiar with the low-level technical details.