]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Fix Potential in TB cutoffs for NMP.
[stockfish] / src / search.cpp
index 8ace674d11a2f7a8845f68aa075fe01ec28921c3..740ad71efee01461cc40b5992c757f2caa4db81e 100644 (file)
@@ -801,10 +801,9 @@ namespace {
         if (nullValue >= beta)
         {
             // Do not return unproven mate or TB scores
-            if (nullValue >= VALUE_TB_WIN_IN_MAX_PLY)
-                nullValue = beta;
+            nullValue = std::min(nullValue, VALUE_TB_WIN_IN_MAX_PLY-1);
 
-            if (thisThread->nmpMinPly || (abs(beta) < VALUE_KNOWN_WIN && depth < 14))
+            if (thisThread->nmpMinPly || depth < 14)
                 return nullValue;
 
             assert(!thisThread->nmpMinPly); // Recursive verification is not allowed
@@ -1555,23 +1554,23 @@ moves_loop: // When in check, search starts here
                     bestValue = std::max(bestValue, futilityBase);
                     continue;
                 }
-        }
-
-        // We prune after the second quiet check evasion move, where being 'in check' is
-        // implicitly checked through the counter, and being a 'quiet move' apart from
-        // being a tt move is assumed after an increment because captures are pushed ahead.
-        if (quietCheckEvasions > 1)
-            break;
-
-        // Continuation history based pruning (~3 Elo)
-        if (   !capture
-            && (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < 0
-            && (*contHist[1])[pos.moved_piece(move)][to_sq(move)] < 0)
-            continue;
+            }
 
-        // Do not search moves with bad enough SEE values (~5 Elo)
-        if (!pos.see_ge(move, Value(-95)))
-            continue;
+            // We prune after the second quiet check evasion move, where being 'in check' is
+            // implicitly checked through the counter, and being a 'quiet move' apart from
+            // being a tt move is assumed after an increment because captures are pushed ahead.
+            if (quietCheckEvasions > 1)
+                break;
+
+            // Continuation history based pruning (~3 Elo)
+            if (   !capture
+                && (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < 0
+                && (*contHist[1])[pos.moved_piece(move)][to_sq(move)] < 0)
+                continue;
+
+            // Do not search moves with bad enough SEE values (~5 Elo)
+            if (!pos.see_ge(move, Value(-95)))
+                continue;
         }
 
         // Speculative prefetch as early as possible