From 744ed85a4dd3f478c4ce26e4257e64bf5c9abbdd Mon Sep 17 00:00:00 2001 From: VoyagerOne Date: Sun, 14 Feb 2016 19:45:10 +0000 Subject: [PATCH 1/1] Fix futility pruning bug PredictedDepth can be negative, causing the futility_margin to be negative. It will be very difficult to tweak moveCount pruning and reduction formula, as they are tuned to prevent this behavior. No functional change Resolves #587 --- src/search.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index d61fca1b..f4c77847 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -969,7 +969,7 @@ moves_loop: // When in check search starts from here && cmh[pos.moved_piece(move)][to_sq(move)] < VALUE_ZERO) continue; - predictedDepth = newDepth - reduction(improving, depth, moveCount); + predictedDepth = std::max(newDepth - reduction(improving, depth, moveCount), DEPTH_ZERO); // Futility pruning: parent node if (predictedDepth < 7 * ONE_PLY) -- 2.39.2