1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Hanlde mate position in dtz probe

Stick to the original code behaviour.
This commit is contained in:
Marco Costalba 2016-05-24 08:52:53 +02:00
parent 36d6a1fd0a
commit f852b0ed8f

View file

@ -1520,7 +1520,10 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result)
minDTZ = dtz;
}
return minDTZ + sign_of(minDTZ); // Convert result from 1-ply search
// Convert result from 1-ply search. Special handle a mate position, when
// there are no legal moves. Return value is somewhat arbitrary, so stick
// to the original TB code that returns -1 in this case.
return minDTZ == 0xFFFF ? - 1 : minDTZ + sign_of(minDTZ);
}
// Check whether there has been at least one repetition of positions