]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Try razoring only for depth > OnePly
[stockfish] / src / search.cpp
index 426f84d92493906ecab9c572084a9d81bbd4ba68..54ff467c1e563314ffed6804744fb1226ee555cf 100644 (file)
@@ -166,7 +166,7 @@ namespace {
   // nodes, and at pre-frontier nodes
   Value FutilityMargin0 = Value(0x80);
   Value FutilityMargin1 = Value(0x100);
-  Value FutilityMargin2 = Value(0x300);
+  Value FutilityMargin2 = Value(0x200);
 
   // Razoring
   Depth RazorDepth = 4*OnePly;
@@ -1035,7 +1035,7 @@ namespace {
         else
             value = alpha + 1; // Just to trigger next condition
 
-        if (value > alpha) // Go with full depth pv search
+        if (value > alpha) // Go with full depth non-pv search
         {
             ss[ply].reduction = Depth(0);
             value = -search(pos, ss, -alpha, newDepth, ply+1, true, threadID);
@@ -1239,10 +1239,13 @@ namespace {
     // Null move search not allowed, try razoring
     else if (   !value_is_mate(beta)
              && approximateEval < beta - RazorMargin
-             && depth < RazorDepth)
+             && depth < RazorDepth
+             && depth > OnePly
+             && ttMove == MOVE_NONE
+             && !pos.has_pawn_on_7th(pos.side_to_move()))
     {
         Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
-        if (v < beta - RazorMargin / 2)
+        if (v < beta - RazorMargin / 2 - int(depth - OnePly) * RazorMargin / 8)
             return v;
     }
 
@@ -1308,17 +1311,19 @@ namespace {
           && !moveIsCapture
           && !move_promotion(move))
       {
-          // History pruning. See ok_to_prune() definition.
+          // History pruning. See ok_to_prune() definition
           if (   moveCount >= 2 + int(depth)
               && ok_to_prune(pos, move, ss[ply].threatMove, depth))
               continue;
 
-          // Value based pruning.
-          if (depth < 3 * OnePly && approximateEval < beta)
+          // Value based pruning
+          if (depth < 7 * OnePly && approximateEval < beta)
           {
               if (futilityValue == VALUE_NONE)
                   futilityValue =  evaluate(pos, ei, threadID)
-                                + (depth < 2 * OnePly ? FutilityMargin1 : FutilityMargin2);
+                                + (depth < 2 * OnePly ? FutilityMargin1 :
+                                + (depth < 6 * OnePly ? FutilityMargin2 + (depth - 2*OnePly) * 32
+                                                      : FutilityMargin2 + (depth - 2*OnePly) * 64));
 
               if (futilityValue < beta)
               {