1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Fix an assert in Probcut

When running the following position:

8/kPp5/2P3p1/p1P1p1P1/2PpPp2/3p1p2/3P1P2/5K2 w - - 0 1

An assert is raised at depth 92:

assert(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE);

This is because it happens that beta = 29832,
so rbeta = 30032 that is > VALUE_INFINITE

Bug spotted and analyzed by Uri, fix suggested by Joerg.

Other fixes where possible but this one is pointed
exactly at the source of the bug, so it is the best
from a code documentation point of view.

bench: 8430785
This commit is contained in:
Marco Costalba 2014-02-22 10:34:48 +01:00
parent b8cfc255d4
commit 012f20d66e

View file

@ -668,7 +668,7 @@ namespace {
&& !ss->skipNullMove && !ss->skipNullMove
&& abs(beta) < VALUE_MATE_IN_MAX_PLY) && abs(beta) < VALUE_MATE_IN_MAX_PLY)
{ {
Value rbeta = beta + 200; Value rbeta = std::min(beta + 200, VALUE_INFINITE);
Depth rdepth = depth - ONE_PLY - 3 * ONE_PLY; Depth rdepth = depth - ONE_PLY - 3 * ONE_PLY;
assert(rdepth >= ONE_PLY); assert(rdepth >= ONE_PLY);