Question to syzygy author

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Question to syzygy author

Post by syzygy »

mcostalba wrote:

Code: Select all

      pos.do_move(move, st, pos.gives_check(move, ci));
      int v = -probe_ab&#40;pos, -2, -wdl + 1, success&#41;;     <-------------   This is wrong
      pos.undo_move&#40;move&#41;;
      if (*success == 0&#41; return 0;
      if &#40;v == wdl&#41;
        return v == 2 ? 1 &#58; 101;   <---------------- Here we immediately return '1'
    &#125;
  &#125;
The simple fix is replacing -probe_ab(...) with -Tablebases::probe_wdl(pos, success). Very slightly more efficient would be:

Code: Select all

      pos.do_move&#40;move, st, pos.gives_check&#40;move, ci&#41;);
      int v = pos.ep_square&#40;) == SQ_NONE ? -probe_ab&#40;pos, -2, -wdl + 1, success&#41;
                                         &#58; -Tablebases&#58;&#58;probe_wdl&#40;pos, success&#41;;
      pos.undo_move&#40;move&#41;;
      if (*success == 0&#41; return 0;
      if &#40;v == wdl&#41;
        return v == 2 ? 1 &#58; 101;
    &#125;
  &#125;
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Question to syzygy author

Post by syzygy »

mcostalba wrote:The point is that DTZ files store a "don't care" value also in case the only possible legal moves are captures.
This is not correct.

The DTZ tables store a don't care only in case:
- the position is a draw, or
- the position is a win or cursed win with dtz = 1 (or dtz = 101).
In the latter case there will be a (cursed) winning capture or pawn move.

Not even losing mate positions are stored as don't care.

The position you were looking at is in the "missing" side of the DTZ table. So the 1-ply probing round must somehow have gone wrong.
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Question to syzygy author

Post by syzygy »

syzygy wrote:The code behind this site has the same bug:
https://syzygy-tables.info/?fen=3K4/8/3 ... _w_-_-_0_1
And the code behind that wonderful site has already been fixed (not by me).