]> git.sesse.net Git - stockfish/commitdiff
Fix aspiration corner case
authorMarco Costalba <mcostalba@gmail.com>
Mon, 28 Feb 2011 19:17:57 +0000 (20:17 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 28 Feb 2011 19:17:57 +0000 (20:17 +0100)
Fix a corner case where we start aspiration window and
suddendly we get a VALUE_KNOWN_WIN / MATE score, this makes
aspiration to blow up in a series of researches loops.

Exit aspiration loop in that case.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 5a0af8f82a0700cea2a8515b414d823b8e9ae3e9..3f367d83bd0218fed704ad6d720d3c0eb2c9a2a9 100644 (file)
@@ -643,8 +643,7 @@ namespace {
 
         // Start with a small aspiration window and, in case of fail high/low,
         // research with bigger window until not failing high/low anymore.
-        while (true)
-        {
+        do {
             // Search starting from ss+1 to allow calling update_gains()
             value = search<PV, false, true>(pos, ss+1, alpha, beta, depth * ONE_PLY, 0);
 
@@ -680,7 +679,8 @@ namespace {
             }
             else
                 break;
-        }
+
+        } while (abs(value) < VALUE_KNOWN_WIN);
 
         // Collect info about search result
         bestMove = Rml[0].pv[0];