X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=132af364d7f787cddbfff1e61c24d2d42b168fa6;hp=4e0e8f9fb3b9cef309aaab24e1fe616c87b949ba;hb=b50eb6bea866a297cd59eb92b7d552480544ff8d;hpb=6f079ae7203d56edca74722990c1f40db555de8a diff --git a/src/search.cpp b/src/search.cpp index 4e0e8f9f..132af364 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -335,8 +335,8 @@ namespace { if (depth >= 5) { delta = Value(16); - alpha = RootMoves[PVIdx].prevScore - delta; - beta = RootMoves[PVIdx].prevScore + delta; + alpha = std::max(RootMoves[PVIdx].prevScore - delta,-VALUE_INFINITE); + beta = std::min(RootMoves[PVIdx].prevScore + delta, VALUE_INFINITE); } // Start with a small aspiration window and, in case of fail high/low, @@ -364,18 +364,18 @@ namespace { if (Signals.stop) return; - // In case of failing high/low increase aspiration window and + // In case of failing low/high increase aspiration window and // research, otherwise exit the loop. - if (bestValue >= beta) - beta += delta; - - else if (bestValue <= alpha) + if (bestValue <= alpha) { - alpha -= delta; + alpha = std::max(bestValue - delta, -VALUE_INFINITE); Signals.failedLowAtRoot = true; Signals.stopOnPonderhit = false; } + else if (bestValue >= beta) + beta = std::min(bestValue + delta, VALUE_INFINITE); + else break;