1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

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
This commit is contained in:
Robert Nurnberg @ elitebook 2024-04-12 08:39:39 +02:00 committed by Joost VandeVondele
parent 249eec6715
commit e58b3b4665

View file

@ -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);