]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Use refinedValue in ProbCut condition
[stockfish] / src / search.cpp
index b9fdcea119a51b4761ebf94c3a2eacdc250991ff..6e440702c9d69fc4ff26efa8fa982b2a565ecc1f 100644 (file)
@@ -763,7 +763,7 @@ namespace {
 
     // Step 2. Check for aborted search and immediate draw
     if ((   StopRequest
-         || pos.is_draw()
+         || pos.is_draw<false>()
          || ss->ply > PLY_MAX) && !RootNode)
         return VALUE_DRAW;
 
@@ -903,9 +903,8 @@ namespace {
     }
 
     // Step 9. ProbCut (is omitted in PV nodes)
-    // If we have a very good capture (i.e. SEE > seeValues[captured_piece_type])
-    // and a reduced search returns a value much above beta, we can (almost) safely
-    // prune the previous move.
+    // If we have a good capture that raises the score well above beta and a reduced
+    // search confirms the score then we can (almost) safely prune the previous move.
     if (   !PvNode
         &&  depth >= RazorDepth + ONE_PLY
         && !inCheck
@@ -918,7 +917,7 @@ namespace {
 
         assert(rdepth >= ONE_PLY);
 
-        MovePicker mp(pos, ttMove, H, Position::see_value(pos.captured_piece_type()));
+        MovePicker mp(pos, ttMove, H, Max(rbeta - refinedValue, VALUE_ZERO));
         pinned = pos.pinned_pieces(pos.side_to_move());
 
         while ((move = mp.get_next_move()) != MOVE_NONE)
@@ -1333,7 +1332,7 @@ split_point_start: // At split points actual search starts from here
     ss->ply = (ss-1)->ply + 1;
 
     // Check for an instant draw or maximum ply reached
-    if (ss->ply > PLY_MAX || pos.is_draw())
+    if (pos.is_draw<true>() || ss->ply > PLY_MAX)
         return VALUE_DRAW;
 
     // Decide whether or not to include checks, this fixes also the type of
@@ -2019,7 +2018,7 @@ split_point_start: // At split points actual search starts from here
            && pos.move_is_pl(tte->move())
            && pos.pl_move_is_legal(tte->move(), pos.pinned_pieces(pos.side_to_move()))
            && ply < PLY_MAX
-           && (!pos.is_draw() || ply < 2))
+           && (!pos.is_draw<false>() || ply < 2))
     {
         pv[ply] = tte->move();
         pos.do_move(pv[ply++], *st++);