From: Stefan Geschwentner Date: Fri, 12 Jul 2019 05:22:46 +0000 (+0200) Subject: Late Move reduction and continuation history X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=389e60741f308bb23904baec0d52552935162e0f Late Move reduction and continuation history Update continuation history after LMR-triggered full depth research. Directly after a LMR-triggered full depth research, we update the continuation history for quiet moves (but with only half stat bonus). STC: LLR: 2.96 (-2.94,2.94) [0.50,4.50] Total: 39657 W: 8966 L: 8604 D: 22087 http://tests.stockfishchess.org/tests/view/5d279fa40ebc5925cf0d4566 LTC: LLR: 2.96 (-2.94,2.94) [0.50,3.50] Total: 32582 W: 5740 L: 5427 D: 21415 http://tests.stockfishchess.org/tests/view/5d27dbf90ebc5925cf0d4b7e Bench: 3239357 --- diff --git a/src/search.cpp b/src/search.cpp index e6446768..ea0c64f1 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -578,7 +578,7 @@ namespace { Move ttMove, move, excludedMove, bestMove; Depth extension, newDepth; Value bestValue, value, ttValue, eval, maxValue; - bool ttHit, ttPv, inCheck, givesCheck, improving; + bool ttHit, ttPv, inCheck, givesCheck, improving, doLMR; bool captureOrPromotion, doFullDepthSearch, moveCountPruning, ttCapture; Piece movedPiece; int moveCount, captureCount, quietCount, singularLMR; @@ -1122,15 +1122,26 @@ moves_loop: // When in check, search starts from here value = -search(pos, ss+1, -(alpha+1), -alpha, d, true); - doFullDepthSearch = (value > alpha && d != newDepth); + doFullDepthSearch = (value > alpha && d != newDepth), doLMR = true; } else - doFullDepthSearch = !PvNode || moveCount > 1; + doFullDepthSearch = !PvNode || moveCount > 1, doLMR = false; // Step 17. Full depth search when LMR is skipped or fails high if (doFullDepthSearch) + { value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); + if (doLMR && !captureOrPromotion) + { + int bonus = stat_bonus(newDepth) / 2; + if (value <= alpha) + bonus = -bonus; + + update_continuation_histories(ss, movedPiece, to_sq(move), bonus); + } + } + // For PV nodes only, do a full PV search on the first move or after a fail // high (in the latter case search only if value < beta), otherwise let the // parent node fail low with value <= alpha and try another move.