From 95d7369e54f20715345cf5408040f3c7d1ec8415 Mon Sep 17 00:00:00 2001 From: Michael Chaly Date: Fri, 4 Feb 2022 22:42:41 +0300 Subject: [PATCH] Introduce movecount pruning for quiet check evasions in qsearch Idea of this patch is that we usually don't consider quiet check evasions as "good" ones and prefer capture based ones instead. So it makes sense to think that if in qsearch 2 quiet check evasions failed to produce anything good 3rd and further ones wouldn't be good either. passed STC https://tests.stockfishchess.org/tests/view/61fc1b1ed508ec6a1c9f397c LLR: 2.94 (-2.94,2.94) <0.00,2.50> Total: 58800 W: 15947 L: 15626 D: 27227 Ptnml(0-2): 273, 6568, 15462, 6759, 338 passed LTC https://tests.stockfishchess.org/tests/view/61fcc56dd508ec6a1c9f5619 LLR: 2.95 (-2.94,2.94) <0.50,3.00> Total: 89544 W: 24208 L: 23810 D: 41526 Ptnml(0-2): 81, 9038, 26134, 9440, 79 closes https://github.com/official-stockfish/Stockfish/pull/3920 bench 4830082 --- src/search.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/search.cpp b/src/search.cpp index 8d5ad97975d..c0f77f8afbc 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1479,6 +1479,8 @@ namespace { contHist, prevSq); + int quietCheckEvasions = 0; + // Loop through the moves until no moves remain or a beta cutoff occurs while ((move = mp.next_move()) != MOVE_NONE) { @@ -1540,6 +1542,15 @@ namespace { && (*contHist[1])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold) continue; + // movecount pruning for quiet check evasions + if ( bestValue > VALUE_TB_LOSS_IN_MAX_PLY + && quietCheckEvasions > 1 + && !captureOrPromotion + && ss->inCheck) + continue; + + quietCheckEvasions += !captureOrPromotion && ss->inCheck; + // Make and search the move pos.do_move(move, st, givesCheck); value = -qsearch(pos, ss+1, -beta, -alpha, depth - 1);