X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=62948590a494c6fc48968abdd0aa3db810006a92;hp=219c10aad7eda8a840bb8338e9d5dc3110a9dc53;hb=1cb2722c955405d6354a1eebcea8652f52b94bdd;hpb=afcee1e8a4aadb9c86e17c71d5943d03268ca6d6 diff --git a/src/search.cpp b/src/search.cpp index 219c10aa..62948590 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -224,7 +224,7 @@ size_t Search::perft(Position& pos, Depth depth) { void Search::think() { - static Book book; // Defined static to initialize the PRNG only once + static PolyglotBook book; // Defined static to initialize the PRNG only once Position& pos = RootPosition; Chess960 = pos.is_chess960(); @@ -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 ?