]> git.sesse.net Git - stockfish/commitdiff
Store score in TT when null search fails high
authorMarco Costalba <mcostalba@gmail.com>
Sat, 3 Apr 2010 07:54:21 +0000 (08:54 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 4 Apr 2010 10:23:18 +0000 (11:23 +0100)
Use full depth, not reduced one. This allows
to avoid to do a null search when in the same
position and at the same or bigger depth the
null search failed high.

A very small increase, if any.

After 963 games at 1+0
Mod vs Orig: +158 =657 -147  +4 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp
src/tt.cpp

index 8b45130a4319b71e16c4815802d6d9ede427e5fa..94c03619a39e8c818739316096f1acfc87b08574 100644 (file)
@@ -1379,13 +1379,18 @@ namespace {
             if (nullValue >= value_mate_in(PLY_MAX))
                 nullValue = beta;
 
-            if (depth < 6 * OnePly)
-                return nullValue;
+            // Do zugzwang verification search for high depths, don't store in TT
+            // if search was stopped.
+            if (   (   depth < 6 * OnePly
+                    || search(pos, ss, beta, depth-5*OnePly, ply, false, threadID) >= beta)
+                && !AbortSearch
+                && !TM.thread_should_stop(threadID))
+            {
+                assert(value_to_tt(nullValue, ply) == nullValue);
 
-            // Do zugzwang verification search
-            Value v = search(pos, ss, beta, depth-5*OnePly, ply, false, threadID);
-            if (v >= beta)
+                TT.store(posKey, nullValue, VALUE_TYPE_LOWER, depth, MOVE_NONE);
                 return nullValue;
+            }
         } else {
             // The null move failed low, which means that we may be faced with
             // some kind of threat. If the previous move was reduced, check if
index 935336dac3c7354e23c878fd1ba62d1a22adf72a..7efc6a0918872d6eb75be6f018c94667c720fc17 100644 (file)
@@ -125,6 +125,7 @@ void TranspositionTable::store(const Key posKey, Value v, ValueType t, Depth d,
           if (tte->key() && t == VALUE_TYPE_EV_LO)
               return;
 
+          // Preserve any exsisting ttMove
           if (m == MOVE_NONE)
               m = tte->move();