From: VoyagerOne Date: Tue, 16 Aug 2016 13:53:45 +0000 (-0400) Subject: Do LMR on captures X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=8493c8c6b8da07a454adcaa160af8e8aa3d6b525 Do LMR on captures STC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 5361 W: 1086 L: 936 D: 3339 http://tests.stockfishchess.org/tests/view/57b31b0f0ebc591c761f643d LTC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 54694 W: 7591 L: 7287 D: 39816 http://tests.stockfishchess.org/tests/view/57b3442b0ebc591c761f6450 bench: 6881120 --- diff --git a/src/search.cpp b/src/search.cpp index 0261a481..9eeafbda 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -962,37 +962,43 @@ moves_loop: // When in check search starts from here // re-searched at full depth. if ( depth >= 3 * ONE_PLY && moveCount > 1 - && !captureOrPromotion) + && (!captureOrPromotion || moveCountPruning)) { Depth r = reduction(improving, depth, moveCount); - Value val = thisThread->history[moved_piece][to_sq(move)] - + (cmh ? (*cmh )[moved_piece][to_sq(move)] : VALUE_ZERO) - + (fmh ? (*fmh )[moved_piece][to_sq(move)] : VALUE_ZERO) - + (fmh2 ? (*fmh2)[moved_piece][to_sq(move)] : VALUE_ZERO) - + thisThread->fromTo.get(~pos.side_to_move(), move); - - // Increase reduction for cut nodes - if (cutNode) - r += 2 * ONE_PLY; - - // Decrease reduction for moves that escape a capture. Filter out - // castling moves, because they are coded as "king captures rook" and - // hence break make_move(). Also use see() instead of see_sign(), - // because the destination square is empty. - else if ( 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) - r -= 2 * ONE_PLY; - - // Decrease/increase reduction for moves with a good/bad history - int rHist = (val - 10000) / 20000; - r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY); + + if (captureOrPromotion) + r -= r ? ONE_PLY : DEPTH_ZERO; + else + { + Value val = thisThread->history[moved_piece][to_sq(move)] + + (cmh ? (*cmh )[moved_piece][to_sq(move)] : VALUE_ZERO) + + (fmh ? (*fmh )[moved_piece][to_sq(move)] : VALUE_ZERO) + + (fmh2 ? (*fmh2)[moved_piece][to_sq(move)] : VALUE_ZERO) + + thisThread->fromTo.get(~pos.side_to_move(), move); + + // Increase reduction for cut nodes + if (cutNode) + r += 2 * ONE_PLY; + + // Decrease reduction for moves that escape a capture. Filter out + // castling moves, because they are coded as "king captures rook" and + // hence break make_move(). Also use see() instead of see_sign(), + // because the destination square is empty. + else if ( 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) + r -= 2 * ONE_PLY; + + // Decrease/increase reduction for moves with a good/bad history + int rHist = (val - 10000) / 20000; + r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY); + } Depth d = std::max(newDepth - r, ONE_PLY); value = -search(pos, ss+1, -(alpha+1), -alpha, d, true); - doFullDepthSearch = (value > alpha && r != DEPTH_ZERO); + doFullDepthSearch = (value > alpha && d != newDepth); } else doFullDepthSearch = !PvNode || moveCount > 1;