diff --git a/src/thread.cpp b/src/thread.cpp index 2e4fc30ff..929c0a4d5 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -350,22 +350,17 @@ void ThreadPool::start_thinking(const OptionsMap& options, Thread* ThreadPool::get_best_thread() const { Thread* bestThread = threads.front().get(); - Value minScore = VALUE_NONE; + Value minScore = VALUE_INFINITE; std::unordered_map votes( 2 * std::min(size(), bestThread->worker->rootMoves.size())); - // Find the minimum score of all threads for (auto&& th : threads) minScore = std::min(minScore, th->worker->rootMoves[0].score); - // Vote according to score and depth, and select the best thread - auto thread_voting_value = [minScore](Thread* th) { - return (th->worker->rootMoves[0].score - minScore + 14) * int(th->worker->rootDepth); - }; - + // Vote according to score, and select the best thread for (auto&& th : threads) - votes[th->worker->rootMoves[0].pv[0]] += thread_voting_value(th.get()); + votes[th->worker->rootMoves[0].pv[0]] += th->worker->rootMoves[0].score - minScore + 14; for (auto&& th : threads) { @@ -383,11 +378,6 @@ Thread* ThreadPool::get_best_thread() const { && is_decisive(newThreadMove.score) && !newThreadMove.score_is_bound(); - // We make sure not to pick a thread with a truncated principal variation. - const bool betterVotingValue = - thread_voting_value(th.get()) * int(newThreadMove.pv.size() > 2) - > thread_voting_value(bestThread) * int(bestThreadMove.pv.size() > 2); - if (bestThreadDecisive) { // Make sure we pick the shortest mate / TB conversion. @@ -402,7 +392,8 @@ Thread* ThreadPool::get_best_thread() const { else if (newThreadDecisive || (!is_loss(newThreadMove.score) && (newThreadMoveVote > bestThreadMoveVote - || (newThreadMoveVote == bestThreadMoveVote && betterVotingValue)))) + || (newThreadMoveVote == bestThreadMoveVote + && newThreadMove.pv.size() > bestThreadMove.pv.size())))) bestThread = th.get(); }