]> git.sesse.net Git - stockfish/commitdiff
Report longest PV lines for multithreaded search
authormstembera <MissingEmail@email>
Tue, 9 Aug 2022 04:33:59 +0000 (21:33 -0700)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 15 Aug 2022 15:46:27 +0000 (17:46 +0200)
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

index 08a78db5f31da450fa7c4003272dff78c4162ce6..c834fa9f9dff0bd1ce23bd2f72f3c20c5c1ece01 100644 (file)
@@ -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;
     }