]> git.sesse.net Git - stockfish/commitdiff
Update History and Counter move on TT hit
authorLucas Braesch <lucas.braesch@gmail.com>
Mon, 9 Dec 2013 10:14:14 +0000 (18:14 +0800)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 10 Dec 2013 05:57:06 +0000 (06:57 +0100)
We already update killers so it is natural to extend to
history and counter move too.

Passed both short TC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 52690 W: 9955 L: 9712 D: 33023

And long TC
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 5555 W: 935 L: 808 D: 3812

bench: 7876473

src/search.cpp

index a739b0491c7a9eae9219ba7e404c83483d04c692..5205126aeba202ac2fb4663bcf9b9e5c4561cac5 100644 (file)
@@ -569,6 +569,7 @@ namespace {
         TT.refresh(tte);
         ss->currentMove = ttMove; // Can be MOVE_NONE
 
         TT.refresh(tte);
         ss->currentMove = ttMove; // Can be MOVE_NONE
 
+        // Update killers, history, and counter move on TT hit
         if (    ttValue >= beta
             &&  ttMove
             && !pos.capture_or_promotion(ttMove)
         if (    ttValue >= beta
             &&  ttMove
             && !pos.capture_or_promotion(ttMove)
@@ -576,6 +577,15 @@ namespace {
         {
             ss->killers[1] = ss->killers[0];
             ss->killers[0] = ttMove;
         {
             ss->killers[1] = ss->killers[0];
             ss->killers[0] = ttMove;
+
+            Value bonus = Value(int(depth) * int(depth));
+            History.update(pos.moved_piece(ttMove), to_sq(ttMove), bonus);
+
+            if (is_ok((ss-1)->currentMove))
+            {
+                Square prevMoveSq = to_sq((ss-1)->currentMove);
+                Countermoves.update(pos.piece_on(prevMoveSq), prevMoveSq, ttMove);
+            }
         }
         return ttValue;
     }
         }
         return ttValue;
     }