X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=f1136e3e5b423cfaed45bae25fbc591c341690a7;hp=0e9674a05cc6bad59c7f4089edf8ac3f73301dab;hb=2985a6b5d7be8b813da528886ff11265bfac449b;hpb=2d9fac1e13ce724b6d5fafdf03d880ca37055dde diff --git a/src/search.cpp b/src/search.cpp index 0e9674a0..f1136e3e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -239,19 +239,19 @@ void MainThread::search() { for (Thread* th: Threads) minScore = std::min(minScore, th->rootMoves[0].score); - // Vote according to score and depth + // Vote according to score and depth, and select the best thread + int64_t bestVote = 0; for (Thread* th : Threads) + { votes[th->rootMoves[0].pv[0]] += (th->rootMoves[0].score - minScore + 14) * int(th->completedDepth); - // Select best thread - auto bestVote = votes[this->rootMoves[0].pv[0]]; - for (Thread* th : Threads) if (votes[th->rootMoves[0].pv[0]] > bestVote) { bestVote = votes[th->rootMoves[0].pv[0]]; bestThread = th; } + } } previousScore = bestThread->rootMoves[0].score; @@ -404,17 +404,14 @@ void Thread::search() { beta = (alpha + beta) / 2; alpha = std::max(bestValue - delta, -VALUE_INFINITE); + failedHighCnt = 0; if (mainThread) - { - failedHighCnt = 0; mainThread->stopOnPonderhit = false; - } } else if (bestValue >= beta) { beta = std::min(bestValue + delta, VALUE_INFINITE); - if (mainThread) - ++failedHighCnt; + ++failedHighCnt; } else break;