]> git.sesse.net Git - stockfish/commitdiff
Clean up depth reduction calculation
authorElbertoOne <ElbertoOne@users.noreply.github.com>
Sun, 28 Feb 2016 13:40:47 +0000 (13:40 +0000)
committerJoona Kiiski <joona@zoox.com>
Sun, 28 Feb 2016 13:40:47 +0000 (13:40 +0000)
Might also be a slight speed up

No functional change

Resolves #593

src/search.cpp

index 7392fada40a80b7c0c09c73bd2a12040b8f92006..72711b6909f7d4b2715dfe0440edfe5574e2b8c3 100644 (file)
@@ -1011,16 +1011,16 @@ moves_loop: // When in check search starts from here
           && !captureOrPromotion)
       {
           Depth r = reduction<PvNode>(improving, depth, moveCount);
+          Value hValue = thisThread->history[pos.piece_on(to_sq(move))][to_sq(move)];
+          Value cmhValue = cmh[pos.piece_on(to_sq(move))][to_sq(move)];
 
           // Increase reduction for cut nodes and moves with a bad history
           if (   (!PvNode && cutNode)
-              || (   thisThread->history[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO
-                  && cmh[pos.piece_on(to_sq(move))][to_sq(move)] <= VALUE_ZERO))
+              || (hValue < VALUE_ZERO && cmhValue <= VALUE_ZERO))
               r += ONE_PLY;
 
           // Decrease/increase reduction for moves with a good/bad history
-          int rHist = (  thisThread->history[pos.piece_on(to_sq(move))][to_sq(move)]
-                       + cmh[pos.piece_on(to_sq(move))][to_sq(move)]) / 14980;
+          int rHist = (hValue + cmhValue) / 14980;
           r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY);
 
           // Decrease reduction for moves that escape a capture. Filter out