]> git.sesse.net Git - stockfish/commitdiff
Avoid truncated PV in the threaded case
authormstembera <MissingEmail@email>
Sat, 10 Dec 2022 02:50:06 +0000 (18:50 -0800)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 12 Dec 2022 07:15:19 +0000 (08:15 +0100)
strongly prefer to pick as bestThread those threads with a longer PV,
among those threads that all found the same bestmove.

extended discussion in #4244
closes https://github.com/official-stockfish/Stockfish/pull/4278

No functional change

src/thread.cpp

index b7471f6026758fc7c2a0763388f9940b9dda37d7..e8723eb7411bff10a386e837c832f4c31ea192cb 100644 (file)
@@ -239,7 +239,8 @@ Thread* ThreadPool::get_best_thread() const {
                  || (   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]]
-                             && thread_value(th) > thread_value(bestThread)))))
+                             &&   thread_value(th) * int(th->rootMoves[0].pv.size() > 2)
+                                > thread_value(bestThread) * int(bestThread->rootMoves[0].pv.size() > 2)))))
             bestThread = th;
 
     return bestThread;