]> git.sesse.net Git - stockfish/commitdiff
Simplify a condition in search()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 13 Jan 2013 11:34:31 +0000 (12:34 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 13 Jan 2013 12:17:16 +0000 (13:17 +0100)
And rearrange best value update in case of SpNode.

No functional change.

src/search.cpp

index dc82d34d312b4d3966984f685fa447ef68ede848..b3f66c6a8001f79845ab783df4206d5a0f803071 100644 (file)
@@ -902,7 +902,7 @@ split_point_start: // At split points actual search starts from here
           continue;
       }
 
-      pvMove = PvNode ? moveCount == 1 : false;
+      pvMove = PvNode && moveCount == 1;
       ss->currentMove = move;
       if (!SpNode && !captureOrPromotion && playedMoveCount < 64)
           movesSearched[playedMoveCount++] = move;
@@ -994,24 +994,21 @@ split_point_start: // At split points actual search starts from here
 
       if (value > bestValue)
       {
-          bestValue = value;
-          if (SpNode) sp->bestValue = value;
+          bestValue = SpNode ? sp->bestValue = value : value;
 
           if (value > alpha)
           {
-              bestMove = move;
-              if (SpNode) sp->bestMove = move;
+              bestMove = SpNode ? sp->bestMove = move : move;
 
-              if (PvNode && value < beta)
-              {
-                  alpha = value; // Update alpha here! Always alpha < beta
-                  if (SpNode) sp->alpha = value;
-              }
+              if (PvNode && value < beta) // Update alpha! Always alpha < beta
+                  alpha = SpNode ? sp->alpha = value : value;
               else
               {
                   assert(value >= beta); // Fail high
 
-                  if (SpNode) sp->cutoff = true;
+                  if (SpNode)
+                      sp->cutoff = true;
+
                   break;
               }
           }