From 48dc239da9b2d04aa797bea6ec63a6ec46c7b4e2 Mon Sep 17 00:00:00 2001 From: Hans Ekbrand Date: Sat, 2 Apr 2022 18:41:32 +0200 Subject: [PATCH] fix ordering of multiPV lines. --- src/mcts/search.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mcts/search.cc b/src/mcts/search.cc index 1936096185..41e082d799 100644 --- a/src/mcts/search.cc +++ b/src/mcts/search.cc @@ -290,7 +290,12 @@ void Search::SendUciInfo() REQUIRES(nodes_mutex_) REQUIRES(counters_mutex_) { if (current_best_edge_ && !edges.empty()) { last_outputted_info_edge_ = current_best_edge_.edge(); } - + // Cutechess treats each UCI-info line atomically, and if we send + // multiple lines we have to send the best line last for it to stay + // on top. This only matters if multipv is set (above one). + if (max_pv > 1) { + std::reverse(uci_infos.begin(), uci_infos.end()); + } uci_responder_->OutputThinkingInfo(&uci_infos); }