Skip to content

Commit

Permalink
Fix wrong mate sign
Browse files Browse the repository at this point in the history
introduced yesterday by the UCI refactoring 9032c6c

fixes #5166
closes #5167

No functional change
  • Loading branch information
robertnurnberg authored and vondele committed Apr 12, 2024
1 parent 249eec6 commit e58b3b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/uci.cpp
Expand Up @@ -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);
Expand Down

3 comments on commit e58b3b4

@Al-cm
Copy link

@Al-cm Al-cm commented on e58b3b4 Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrong sign problem still applies for eval values of -200 (black is winning). They will show as +200 (White is winning). Not sure which code to look at for the cause because I am no coder.

@peregrineshahin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrong sign problem still applies for eval values of -200 (black is winning). They will show as +200 (White is winning). Not sure which code to look at for the cause because I am no coder.

You are correct we will fix that

@Al-cm
Copy link

@Al-cm Al-cm commented on e58b3b4 Apr 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrong sign problem still applies for eval values of -200 (black is winning). They will show as +200 (White is winning). Not sure which code to look at for the cause because I am no coder.

You are correct we will fix that

Thanks, problem fixed with commit 1f7534e

Please sign in to comment.