X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=d86d62030e6bca623487e84fab4270e878be09c0;hp=a35438be610af50cec2db6237a120ee6f00b9ccd;hb=90f5937373974adf4ae7216feedf5abc4d62debd;hpb=5bbd94409955b3db88e43527922fae4840a9ecb2 diff --git a/src/search.cpp b/src/search.cpp index a35438be..d86d6203 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -642,7 +642,7 @@ namespace { assert(0 <= ss->ply && ss->ply < MAX_PLY); ss->currentMove = (ss+1)->excludedMove = bestMove = MOVE_NONE; - (ss+1)->skipEarlyPruning = false; (ss+1)->reduction = DEPTH_ZERO; + (ss+1)->skipEarlyPruning = false; (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE; // Step 4. Transposition table lookup. We don't want the score of a partial @@ -982,36 +982,33 @@ moves_loop: // When in check search starts from here // re-searched at full depth. if ( depth >= 3 * ONE_PLY && moveCount > 1 - && !captureOrPromotion - && move != ss->killers[0] - && move != ss->killers[1]) + && !captureOrPromotion) { - ss->reduction = reduction(improving, depth, moveCount); + Depth r = reduction(improving, depth, moveCount); // 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)) - ss->reduction += ONE_PLY; + r += ONE_PLY; // Decrease reduction for moves with a good history if ( 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) - ss->reduction = std::max(DEPTH_ZERO, ss->reduction - ONE_PLY); + r = std::max(DEPTH_ZERO, r - ONE_PLY); // Decrease reduction for moves that escape a capture - if ( ss->reduction + if ( r && type_of(move) == NORMAL && type_of(pos.piece_on(to_sq(move))) != PAWN && pos.see(make_move(to_sq(move), from_sq(move))) < VALUE_ZERO) - ss->reduction = std::max(DEPTH_ZERO, ss->reduction - ONE_PLY); + r = std::max(DEPTH_ZERO, r - ONE_PLY); - Depth d = std::max(newDepth - ss->reduction, ONE_PLY); + Depth d = std::max(newDepth - r, ONE_PLY); value = -search(pos, ss+1, -(alpha+1), -alpha, d, true); - doFullDepthSearch = (value > alpha && ss->reduction != DEPTH_ZERO); - ss->reduction = DEPTH_ZERO; + doFullDepthSearch = (value > alpha && r != DEPTH_ZERO); } else doFullDepthSearch = !PvNode || moveCount > 1;