Extract bestMove and ponderMove after the PV.

Extracting ponderMove may have the unintentional effect of extending the
PV by one move (which should not be displayed), so we need to extract it
after we've extracted the PV. We still need to both before the MPI exchange,
though.

Patch by vondele, merely committed by me.
This commit is contained in:
Steinar H. Gunderson
2026-01-02 09:24:56 +01:00
parent 3d577337c2
commit bd3fd8ba79
+6 -6
View File
@@ -246,12 +246,6 @@ void Search::Worker::start_searching() {
main_manager()->bestPreviousScore = bestThread->rootMoves[0].score;
main_manager()->bestPreviousAverageScore = bestThread->rootMoves[0].averageScore;
Move bestMove = bestThread->rootMoves[0].pv[0];
Move ponderMove = Move::none();
if (bestThread->rootMoves[0].pv.size() > 1
|| bestThread->rootMoves[0].extract_ponder_from_tt(tt, rootPos))
ponderMove = bestThread->rootMoves[0].pv[1];
// Temporarily switch out onUpdateFull to capture the PV information that we need,
// so that we can exchange it through MPI. (We may end up not actually printing
// it out.)
@@ -264,6 +258,12 @@ void Search::Worker::start_searching() {
assert(!serializedInfo.empty());
main_manager()->updates.onUpdateFull = std::move(oldOnUpdateFull);
Move bestMove = bestThread->rootMoves[0].pv[0];
Move ponderMove = Move::none();
if (bestThread->rootMoves[0].pv.size() > 1
|| bestThread->rootMoves[0].extract_ponder_from_tt(tt, rootPos))
ponderMove = bestThread->rootMoves[0].pv[1];
// Exchange info as needed
Distributed::MoveInfo mi{bestMove.raw(), ponderMove.raw(), bestThread->completedDepth,
bestThread->rootMoves[0].score, Distributed::rank()};