]> git.sesse.net Git - stockfish/commitdiff
Prefer ttMove to tte->move() in search()
authorMarco Costalba <mcostalba@gmail.com>
Mon, 16 May 2011 08:59:51 +0000 (10:59 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 17 May 2011 11:17:29 +0000 (12:17 +0100)
Avoids aliasing problems due to TT overwrites.

Node changes becuase of IID.

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

index 58a82d9dc24699cf04ad76b8b3dae4d40a44ec71..0fbdab56722b41c8368ad0123dbe3b25c525d764 100644 (file)
@@ -871,8 +871,8 @@ namespace {
         search<PvNode>(pos, ss, alpha, beta, d);
         ss->skipNullMove = false;
 
-        ttMove = ss->bestMove;
         tte = TT.probe(posKey);
+        ttMove = tte ? tte->move() : MOVE_NONE;
     }
 
 split_point_start: // At split points actual search starts from here
@@ -885,8 +885,7 @@ split_point_start: // At split points actual search starts from here
     singularExtensionNode =   !Root
                            && !SpNode
                            && depth >= SingularExtensionDepth[PvNode]
-                           && tte
-                           && tte->move()
+                           && ttMove != MOVE_NONE
                            && !excludedMove // Do not allow recursive singular extension search
                            && (tte->type() & VALUE_TYPE_LOWER)
                            && tte->depth() >= depth - 3 * ONE_PLY;
@@ -949,7 +948,7 @@ split_point_start: // At split points actual search starts from here
       // on all the other moves but the ttMove, if result is lower than ttValue minus
       // a margin then we extend ttMove.
       if (   singularExtensionNode
-          && move == tte->move()
+          && move == ttMove
           && ext < ONE_PLY)
       {
           Value ttValue = value_from_tt(tte->value(), ss->ply);