## Stockfish has still one tablebase issue?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Jouni
Posts: 3336
Joined: Wed Mar 08, 2006 8:15 pm

### Stockfish has still one tablebase issue?

Jouni
syzygy
Posts: 5587
Joined: Tue Feb 28, 2012 11:56 pm

### Re: Stockfish has still one tablebase issue?

Jouni wrote: Thu Apr 18, 2024 10:01 am Unbelievable, but https://github.com/official-stockfish/S ... ssues/5175 .
This is by design to reduce the size of the tables. If SF or any other engine reaches a winning KBNvK ending, it will simply win. Only if you set up a position where moves were already wasted can there be 1 ply of inaccuracy. This can then even happen in KQvK.

For tables like KNNvKP and KBBvKN that may need >100 ply to a zeroing move, the DTZ values stored in the table are fully accurate.
syzygy
Posts: 5587
Joined: Tue Feb 28, 2012 11:56 pm

### Re: Stockfish has still one tablebase issue?

https://github.com/syzygy1/tb/blob/mast ... 4C1-L521C3

Code: Select all

``````// Probe the DTZ table for a particular position.
// If *success != 0, the probe was successful.
// The return value is from the point of view of the side to move:
//         n < -100 : loss, but draw under 50-move rule
// -100 <= n < -1   : loss in n ply (assuming 50-move counter == 0)
//         0	    : draw
//     1 < n <= 100 : win in n ply (assuming 50-move counter == 0)
//   100 < n        : win, but draw under 50-move rule
//
// If the position is mate, -1 is returned instead of 0.
//
// The return value n can be off by 1: a return value -n can mean a loss
// in n+1 ply and a return value +n can mean a win in n+1 ply. This
// cannot happen for tables with positions exactly on the "edge" of
// the 50-move rule.
//
// This means that if dtz > 0 is returned, the position is certainly
// a win if dtz + 50-move-counter <= 99. Care must be taken that the engine
// picks moves that preserve dtz + 50-move-counter <= 99.
//
// If n = 100 immediately after a capture or pawn move, then the position
// is also certainly a win, and during the whole phase until the next
// capture or pawn move, the inequality to be preserved is
// dtz + 50-movecounter <= 100.
//
// In short, if a move is available resulting in dtz + 50-move-counter <= 99,
// then do not accept moves leading to dtz + 50-move-counter == 100.
//``````
And the same comment is still in SF:
https://github.com/official-stockfish/S ... 1486-L1511
Jouni
Posts: 3336
Joined: Wed Mar 08, 2006 8:15 pm

### Re: Stockfish has still one tablebase issue?

I think this kind of testpositions with counter are nonsense. So no issue really!
Jouni