mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Further simplify opponent side DTZ search
This commit is contained in:
parent
eb16759a48
commit
e9e9cfa9bf
1 changed files with 3 additions and 15 deletions
|
@ -1487,29 +1487,17 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result)
|
||||||
for (const Move& move : MoveList<LEGAL>(pos))
|
for (const Move& move : MoveList<LEGAL>(pos))
|
||||||
{
|
{
|
||||||
pos.do_move(move, st, pos.gives_check(move, ci));
|
pos.do_move(move, st, pos.gives_check(move, ci));
|
||||||
|
dtz = -probe_dtz(pos, result);
|
||||||
if (wdl > WDLDraw)
|
|
||||||
dtz = -probe_dtz(pos, result) + 1;
|
|
||||||
|
|
||||||
else if (st.rule50 > 0) // Not a capture or pawn move
|
|
||||||
dtz = -probe_dtz(pos, result) - 1;
|
|
||||||
|
|
||||||
else if (wdl == WDLLoss)
|
|
||||||
dtz = -1;
|
|
||||||
|
|
||||||
else
|
|
||||||
dtz = search(pos, WDLCursedWin, WDLWin, result) == WDLWin ? 0 : -101;
|
|
||||||
|
|
||||||
pos.undo_move(move);
|
pos.undo_move(move);
|
||||||
|
|
||||||
if (*result == FAIL)
|
if (*result == FAIL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (dtz < minDTZ && (wdl < WDLDraw || dtz > 1)) // Avoid the case of a draw
|
if (dtz < minDTZ && dtz) // Skip the draw case
|
||||||
minDTZ = dtz;
|
minDTZ = dtz;
|
||||||
}
|
}
|
||||||
|
|
||||||
return minDTZ;
|
return minDTZ > 0 ? minDTZ + 1 : minDTZ - 1; // Convert result from 1-ply search
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether there has been at least one repetition of positions
|
// Check whether there has been at least one repetition of positions
|
||||||
|
|
Loading…
Add table
Reference in a new issue