X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=07680f1d1830e4447c7f61da25be41407bc69510;hp=7dc674882ee4315b3fe8922c7ab6d2252ab456c9;hb=b9f1c9bf3f5ba240423a4f1ca8a2fb0f975a775e;hpb=97d2cc9a9c1c4b6ff1b470676fa18c7fc6509886 diff --git a/src/search.cpp b/src/search.cpp index 7dc67488..07680f1d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -187,6 +187,7 @@ void Search::clear() { Time.availableNodes = 0; TT.clear(); Threads.clear(); + Tablebases::init(Options["SyzygyPath"]); // Free up mapped files } @@ -387,7 +388,7 @@ void Thread::search() { if (rootDepth >= 5 * ONE_PLY) { Value previousScore = rootMoves[pvIdx].previousScore; - delta = Value(18); + delta = Value(20); alpha = std::max(previousScore - delta,-VALUE_INFINITE); beta = std::min(previousScore + delta, VALUE_INFINITE); @@ -401,9 +402,11 @@ void Thread::search() { // Start with a small aspiration window and, in the case of a fail // high/low, re-search with a bigger window until we don't fail // high/low anymore. + int failedHighCnt = 0; while (true) { - bestValue = ::search(rootPos, ss, alpha, beta, rootDepth, false); + Depth adjustedDepth = std::max(ONE_PLY, rootDepth - failedHighCnt * ONE_PLY); + bestValue = ::search(rootPos, ss, alpha, beta, adjustedDepth, false); // Bring the best move to the front. It is critical that sorting // is done with a stable algorithm because all the values but the @@ -436,12 +439,17 @@ void Thread::search() { if (mainThread) { + failedHighCnt = 0; failedLow = true; Threads.stopOnPonderhit = false; } } else if (bestValue >= beta) + { beta = std::min(bestValue + delta, VALUE_INFINITE); + if (mainThread) + ++failedHighCnt; + } else break; @@ -933,10 +941,15 @@ moves_loop: // When in check, search starts from here extension = ONE_PLY; } else if ( givesCheck // Check extension (~2 Elo) - && !moveCountPruning && pos.see_ge(move)) extension = ONE_PLY; + // Extension for king moves that change castling rights + if ( pos.can_castle(us) + && type_of(movedPiece) == KING + && depth < 12 * ONE_PLY) + extension = ONE_PLY; + // Calculate new depth for this move newDepth = depth - ONE_PLY + extension; @@ -1133,8 +1146,6 @@ moves_loop: // When in check, search starts from here break; } } - else if (PvNode && !rootNode && value == alpha) - update_pv(ss->pv, move, (ss+1)->pv); } if (move != bestMove)