Fix wrong sign for 200 TB score

Fix another case of 9032c6cbe7

*    TB values can have a distance of 0, mainly when we are in a tb position but haven't found mate.
*    Add a missing whitespace to UCIEngine::on_update_no_moves()

Closes https://github.com/official-stockfish/Stockfish/pull/5172

No functional change
This commit is contained in:
Disservin
2024-04-13 21:54:10 +02:00
committed by Joost VandeVondele
parent 4912f5b0b5
commit c55ae376f6
3 changed files with 8 additions and 7 deletions
+3 -3
View File
@@ -357,9 +357,9 @@ std::string UCIEngine::format_score(const Score& s) {
auto m = (mate.plies > 0 ? (mate.plies + 1) : mate.plies) / 2;
return std::string("mate ") + std::to_string(m);
},
[](Score::TBWin tb) -> std::string {
[](Score::Tablebase 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.win ? TB_CP - tb.plies : -TB_CP - tb.plies));
},
[](Score::InternalUnits units) -> std::string {
return std::string("cp ") + std::to_string(units.value);
@@ -435,7 +435,7 @@ Move UCIEngine::to_move(const Position& pos, std::string str) {
}
void UCIEngine::on_update_no_moves(const Engine::InfoShort& info) {
sync_cout << "info depth" << info.depth << " score " << format_score(info.score) << sync_endl;
sync_cout << "info depth " << info.depth << " score " << format_score(info.score) << sync_endl;
}
void UCIEngine::on_update_full(const Engine::InfoFull& info, bool showWDL) {