]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
IncrementalFutilityMargin to 4 and increased pruning
[stockfish] / src / search.cpp
index 7eb04308b4c3bbd6c72247a6d920927ffc91b9e5..d8e60a129317f90acda38e5f6f1ae6b5c6b090bf 100644 (file)
@@ -180,7 +180,7 @@ namespace {
   const Value FutilityMarginQS = Value(0x80);
 
   // Each move futility margin is decreased
-  const Value IncrementalFutilityMargin = Value(0x8);
+  const Value IncrementalFutilityMargin = Value(0x4);
 
   // Remaining depth:                  1 ply         1.5 ply       2 ply         2.5 ply       3 ply         3.5 ply
   const Value FutilityMargins[12] = { Value(0x100), Value(0x120), Value(0x200), Value(0x220), Value(0x250), Value(0x270),
@@ -1139,9 +1139,8 @@ namespace {
         ttMove = ss[ply].pv[ply];
         tte = TT.retrieve(pos.get_key());
 
-        // Following assert could fail, for instance when we have
-        // moveCount == 0 we return without saving a TT entry.
-        /* assert(tte); */
+        // If tte->move() != MOVE_NONE then it equals ttMove
+        assert(!(tte && tte->move()) || tte->move() == ttMove);
     }
 
     // Initialize a MovePicker object for the current position, and prepare
@@ -1170,9 +1169,7 @@ namespace {
       // To verify this we do a reduced search on all the other moves but the ttMove,
       // if result is lower then TT value minus a margin then we assume ttMove is the
       // only one playable. It is a kind of relaxed single reply extension.
-      // Note that could be ttMove != tte->move() due to IID, so we always use tte->move()
-      // to avoid aliases when we probe tte->depth() and tte->type()
-      if (   depth >= 8 * OnePly
+      if (   depth >= 6 * OnePly
           && tte
           && move == tte->move()
           && ext < OnePly
@@ -1183,7 +1180,7 @@ namespace {
 
           if (abs(ttValue) < VALUE_KNOWN_WIN)
           {
-              Value excValue = search(pos, ss, ttValue - SingleReplyMargin, depth / 2, ply, false, threadID, ttMove);
+              Value excValue = search(pos, ss, ttValue - SingleReplyMargin, depth / 2, ply, false, threadID, move);
 
               // If search result is well below the foreseen score of the ttMove then we
               // assume ttMove is the only one realistically playable and we extend it.
@@ -1455,6 +1452,12 @@ namespace {
     // Move count pruning limit
     const int MCLimit = 3 + (1 << (3*int(depth)/8));
 
+    /*
+    for (int d = 2; d < 16; d++)
+        std::cout << d << " -> " << 56*(0+2*bitScanReverse32(1 * int(d) * int(d) / 2)) << std::endl;
+        //std::cout << d << " -> " << 32*(1+3*bitScanReverse32(1 * int(d) * int(d))) << std::endl;
+    */
+
     // Loop through all legal moves until no moves remain or a beta cutoff occurs
     while (   bestValue < beta
            && (move = mp.get_next_move()) != MOVE_NONE
@@ -1476,8 +1479,6 @@ namespace {
       // To verify this we do a reduced search on all the other moves but the ttMove,
       // if result is lower then TT value minus a margin then we assume ttMove is the
       // only one playable. It is a kind of relaxed single reply extension.
-      // Note that could be ttMove != tte->move() due to IID, so we always use tte->move()
-      // to avoid aliases when we probe tte->depth() and tte->type()
       if (   depth >= 8 * OnePly
           && tte
           && move == tte->move()
@@ -1490,7 +1491,7 @@ namespace {
 
           if (abs(ttValue) < VALUE_KNOWN_WIN)
           {
-              Value excValue = search(pos, ss, ttValue - SingleReplyMargin, depth / 2, ply, false, threadID, ttMove);
+              Value excValue = search(pos, ss, ttValue - SingleReplyMargin, depth / 2, ply, false, threadID, move);
 
               // If search result is well below the foreseen score of the ttMove then we
               // assume ttMove is the only one realistically playable and we extend it.
@@ -1518,10 +1519,10 @@ namespace {
 
           // Value based pruning
           if (approximateEval < beta)
-          {
+          {//dbg_before();
               if (futilityValue == VALUE_NONE)
                   futilityValue =  evaluate(pos, ei, threadID)
-                                 + 64*(2+bitScanReverse32(int(depth) * int(depth)));
+                                 + 56*(0+2*bitScanReverse32(1 * int(depth) * int(depth) / 2));
 
               futilityValueScaled = futilityValue - moveCount * IncrementalFutilityMargin;
 
@@ -1531,6 +1532,7 @@ namespace {
                       bestValue = futilityValueScaled;
                   continue;
               }
+           //dbg_after(); // 36% (inc == 8), 40% (inc == 4), 37%(56)
           }
       }