]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Fix a comment
[stockfish] / src / search.cpp
index d61c5939dbf4065ddb21c7cf00eab6fa6b3c7f27..a4ce7eff3abf10c7a76c057c75271a4f1a4949df 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);
@@ -1073,7 +1073,9 @@ namespace {
           // If we are at ply 1, and we are searching the first root move at
           // ply 0, set the 'Problem' variable if the score has dropped a lot
           // (from the computer's point of view) since the previous iteration:
-          if (Iteration >= 2 && -value <= ValueByIteration[Iteration-1] - ProblemMargin)
+          if (   ply == 1
+              && Iteration >= 2
+              && -value <= ValueByIteration[Iteration-1] - ProblemMargin)
               Problem = true;
       }
 
@@ -1306,18 +1308,18 @@ 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 < 6 * OnePly && approximateEval < beta)
           {
               if (futilityValue == VALUE_NONE)
                   futilityValue =  evaluate(pos, ei, threadID)
-                                + (depth < 2 * OnePly ? FutilityMargin1 : FutilityMargin2);
-
+                                + (depth < 2 * OnePly ? FutilityMargin1
+                                                      : FutilityMargin2 + (depth - 2*OnePly) * 32);
               if (futilityValue < beta)
               {
                   if (futilityValue > bestValue)
@@ -1775,8 +1777,10 @@ namespace {
         }
         // If we are at ply 1, and we are searching the first root move at
         // ply 0, set the 'Problem' variable if the score has dropped a lot
-        // (from the computer's point of view) since the previous iteration:
-        if (Iteration >= 2 && -value <= ValueByIteration[Iteration-1] - ProblemMargin)
+        // (from the computer's point of view) since the previous iteration.
+        if (   sp->ply == 1
+            && Iteration >= 2
+            && -value <= ValueByIteration[Iteration-1] - ProblemMargin)
             Problem = true;
       }
       lock_release(&(sp->lock));
@@ -1785,7 +1789,7 @@ namespace {
     lock_grab(&(sp->lock));
 
     // If this is the master thread and we have been asked to stop because of
-    // a beta cutoff higher up in the tree, stop all slave threads:
+    // a beta cutoff higher up in the tree, stop all slave threads.
     if (sp->master == threadID && thread_should_stop(threadID))
         for (int i = 0; i < ActiveThreads; i++)
             if (sp->slaves[i])