From d777ea79fff0f651bd948c881946cd06bebd9381 Mon Sep 17 00:00:00 2001 From: Vizvezdenec Date: Wed, 5 May 2021 19:03:20 +0300 Subject: [PATCH] Cleanup of likelyFailLow logic This patch broadens and simplifies definition of PvNode that is likely to fail low. New definition can be described as following "If node was already researched at depth >= current depth and failed low there" which is more logical than the previous version and takes less space + allows to not recompute it every time during move loop. Passed simplification STC https://tests.stockfishchess.org/tests/view/609148bf95e7f1852abd2e82 LLR: 2.93 (-2.94,2.94) <-2.50,0.50> Total: 20128 W: 1865 L: 1751 D: 16512 Ptnml(0-2): 63, 1334, 7165, 1430, 72 Passed simplification LTC https://tests.stockfishchess.org/tests/view/6091691295e7f1852abd2e8b LLR: 2.94 (-2.94,2.94) <-2.50,0.50> Total: 95128 W: 3498 L: 3481 D: 88149 Ptnml(0-2): 41, 2956, 41549, 2981, 37 closes https://github.com/official-stockfish/Stockfish/pull/3455 Bench: 3933037 --- src/search.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index fd833b81..bcd53f9e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1006,6 +1006,13 @@ moves_loop: // When in check, search starts from here value = bestValue; singularQuietLMR = moveCountPruning = false; + // Indicate PvNodes that will probably fail low if the node was searched + // at a depth equal or greater than the current depth, and the result of this search was a fail low. + bool likelyFailLow = PvNode + && ttMove + && (tte->bound() & BOUND_UPPER) + && tte->depth() >= depth; + // Mark this node as being searched ThreadHolding th(thisThread, posKey, ss->ply); @@ -1044,14 +1051,6 @@ moves_loop: // When in check, search starts from here movedPiece = pos.moved_piece(move); givesCheck = pos.gives_check(move); - // Indicate PvNodes that will probably fail low if node was searched with non-PV search - // at depth equal or greater to current depth and result of this search was far below alpha - bool likelyFailLow = PvNode - && ttMove - && (tte->bound() & BOUND_UPPER) - && ttValue < alpha + 200 + 100 * depth - && tte->depth() >= depth; - // Calculate new depth for this move newDepth = depth - 1; -- 2.39.2