From e58b3b4665469a793a0976d7a28f61fcd771b565 Mon Sep 17 00:00:00 2001 From: "Robert Nurnberg @ elitebook" Date: Fri, 12 Apr 2024 08:39:39 +0200 Subject: [PATCH] Fix wrong mate sign introduced yesterday by the UCI refactoring 9032c6cbe fixes #5166 closes https://github.com/official-stockfish/Stockfish/pull/5167 No functional change --- src/uci.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index d6936d38b23..a328ccb0868 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -360,12 +360,12 @@ std::string UCIEngine::format_score(const Score& s) { constexpr int TB_CP = 20000; const auto format = overload{[](Score::Mate mate) -> std::string { - auto m = (mate.plies > 0 ? (mate.plies + 1) : -mate.plies) / 2; + auto m = (mate.plies > 0 ? (mate.plies + 1) : mate.plies) / 2; return std::string("mate ") + std::to_string(m); }, [](Score::TBWin tb) -> std::string { return std::string("cp ") - + std::to_string((tb.plies > 0 ? TB_CP - tb.plies : -TB_CP + tb.plies)); + + std::to_string((tb.plies > 0 ? TB_CP - tb.plies : -TB_CP - tb.plies)); }, [](Score::InternalUnits units) -> std::string { return std::string("cp ") + std::to_string(units.value);