]> git.sesse.net Git - stockfish/commitdiff
Use TT in qsearch
authorMarco Costalba <mcostalba@gmail.com>
Tue, 9 Sep 2008 05:37:46 +0000 (07:37 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 9 Sep 2008 05:37:46 +0000 (07:37 +0200)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index b750047e2e4b9e9515f3b77184995bacc59dee56..9636ee4065722b70a66a7169dc51f4e3433d0a55 100644 (file)
@@ -1299,6 +1299,11 @@ namespace {
     if (pos.is_draw())
         return VALUE_DRAW;
 
+    // Transposition table lookup
+    const TTEntry* tte = TT.retrieve(pos);
+    if (tte && ok_to_use_TT(tte, depth, beta, ply))
+        return value_from_tt(tte->value(), ply);
+
     // Evaluate the position statically:
     Value staticValue = evaluate(pos, ei, threadID);
 
@@ -1396,6 +1401,9 @@ namespace {
 
     assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
 
+    // Update transposition table
+    TT.store(pos, value_to_tt(bestValue, ply), depth, MOVE_NONE, VALUE_TYPE_EXACT);
+
     return bestValue;
   }