From 4568f6369bfb94d8a105a8074e43e8d79c57eaee Mon Sep 17 00:00:00 2001 From: mstembera Date: Mon, 8 Aug 2022 21:33:59 -0700 Subject: [PATCH] Report longest PV lines for multithreaded search In case several threads find the same bestmove, report the longest PV line found. closes https://github.com/official-stockfish/Stockfish/pull/4126 No functional change. --- src/thread.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/thread.cpp b/src/thread.cpp index 08a78db5..c834fa9f 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -237,7 +237,9 @@ Thread* ThreadPool::get_best_thread() const { } else if ( th->rootMoves[0].score >= VALUE_TB_WIN_IN_MAX_PLY || ( th->rootMoves[0].score > VALUE_TB_LOSS_IN_MAX_PLY - && votes[th->rootMoves[0].pv[0]] > votes[bestThread->rootMoves[0].pv[0]])) + && ( votes[th->rootMoves[0].pv[0]] > votes[bestThread->rootMoves[0].pv[0]] + || ( votes[th->rootMoves[0].pv[0]] == votes[bestThread->rootMoves[0].pv[0]] + && th->rootMoves[0].pv.size() > bestThread->rootMoves[0].pv.size())))) bestThread = th; }