mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 02:27:00 +08:00
Fix a rare case of wrong TB ranking
of a root move leading to a 3-fold repetition. With this small fix a draw ranking and thus a draw score is being applied. This works for both, ranking by dtz or wdl tables. Fixes https://github.com/official-stockfish/Stockfish/issues/3542 (No functional change without TBs.) Bench: 4877339
This commit is contained in:
@@ -1536,6 +1536,14 @@ bool Tablebases::root_probe(Position& pos, Search::RootMoves& rootMoves) {
|
|||||||
WDLScore wdl = -probe_wdl(pos, &result);
|
WDLScore wdl = -probe_wdl(pos, &result);
|
||||||
dtz = dtz_before_zeroing(wdl);
|
dtz = dtz_before_zeroing(wdl);
|
||||||
}
|
}
|
||||||
|
else if (pos.is_draw(1))
|
||||||
|
{
|
||||||
|
// In case a root move leads to a draw by repetition or
|
||||||
|
// 50-move rule, we set dtz to zero. Note: since we are
|
||||||
|
// only 1 ply from the root, this must be a true 3-fold
|
||||||
|
// repetition inside the game history.
|
||||||
|
dtz = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Otherwise, take dtz for the new position and correct by 1 ply
|
// Otherwise, take dtz for the new position and correct by 1 ply
|
||||||
@@ -1586,6 +1594,7 @@ bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves) {
|
|||||||
|
|
||||||
ProbeState result;
|
ProbeState result;
|
||||||
StateInfo st;
|
StateInfo st;
|
||||||
|
WDLScore wdl;
|
||||||
|
|
||||||
bool rule50 = Options["Syzygy50MoveRule"];
|
bool rule50 = Options["Syzygy50MoveRule"];
|
||||||
|
|
||||||
@@ -1594,7 +1603,10 @@ bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves) {
|
|||||||
{
|
{
|
||||||
pos.do_move(m.pv[0], st);
|
pos.do_move(m.pv[0], st);
|
||||||
|
|
||||||
WDLScore wdl = -probe_wdl(pos, &result);
|
if (pos.is_draw(1))
|
||||||
|
wdl = WDLDraw;
|
||||||
|
else
|
||||||
|
wdl = -probe_wdl(pos, &result);
|
||||||
|
|
||||||
pos.undo_move(m.pv[0]);
|
pos.undo_move(m.pv[0]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user