Fix reported DTZ for mate-in-1-ply positions
authorsyzygy1 <3028851+syzygy1@users.noreply.github.com>
Sat, 14 Apr 2018 06:36:29 +0000 (08:36 +0200)
committerStéphane Nicolet <cassio@free.fr>
Sat, 14 Apr 2018 06:36:41 +0000 (08:36 +0200)
commitae0bb6dc2b490a8879279ee741d20fcdbbfe2fd3
tree469d78840c215ed62a07840a39306ebf1022fb01
parent6413d9b1f965ed73154fdffb36476c82a2c66c96
Fix reported DTZ for mate-in-1-ply positions

This corrects a bug in Tablebases::probe_dtz() which sometimes causes
a higher DTZ value to be returned for the position one ply before mate
than for the position two plies before mate.

The problem was reported by Kolja Kühn here:
http://talkchess.com/forum/viewtopic.php?p=757497#757497

It is explained here:
http://talkchess.com/forum/viewtopic.php?p=757506#757506

I have also adjusted some comments to make clear that probe_dtz()
returns -1 for a mate position.

Closes https://github.com/official-stockfish/Stockfish/pull/1546

No functional change
src/syzygy/tbprobe.cpp