From: Marco Costalba Date: Mon, 10 Sep 2012 16:24:53 +0000 (+0200) Subject: Don't exit earlier from aspiration window loop X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=6008f6538e9c3912c88e89d77ef3e3d3351a6e55;hp=afcee1e8a4aadb9c86e17c71d5943d03268ca6d6 Don't exit earlier from aspiration window loop Currently we exit the loop when abs(bestValue) >= VALUE_KNOWN_WIN but there is no logical reason for this. It seems more natural to re-search again with full open window. This has practically no impact in most cases, we have a 'no functional change' running 'bench' command. --- diff --git a/src/search.cpp b/src/search.cpp index 219c10aa..eeca9738 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -365,7 +365,8 @@ namespace { // Start with a small aspiration window and, in case of fail high/low, // research with bigger window until not failing high/low anymore. - do { + while (true) + { // Search starts from ss+1 to allow referencing (ss-1). This is // needed by update gains and ss copy when splitting at Root. bestValue = search(pos, ss+1, alpha, beta, depth * ONE_PLY); @@ -419,9 +420,15 @@ namespace { else break; - assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE); + // Search with full window in case we have a win/mate score + if (abs(bestValue) >= VALUE_KNOWN_WIN) + { + alpha = -VALUE_INFINITE; + beta = VALUE_INFINITE; + } - } while (abs(bestValue) < VALUE_KNOWN_WIN); + assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE); + } } // Skills: Do we need to pick now the best move ?