]> git.sesse.net Git - stockfish/commitdiff
Fix futility pruning bug
authorVoyagerOne <excelgeek@gmail.com>
Sun, 14 Feb 2016 19:45:10 +0000 (19:45 +0000)
committerJoona Kiiski <joona@zoox.com>
Sun, 14 Feb 2016 19:48:46 +0000 (19:48 +0000)
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

index d61fca1bca5a3d5d91749f9ad2f1a1966f1349e4..f4c77847d25bb814956c3b110741e9229603b846 100644 (file)
@@ -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<PvNode>(improving, depth, moveCount);
+          predictedDepth = std::max(newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO);
 
           // Futility pruning: parent node
           if (predictedDepth < 7 * ONE_PLY)