Skip to content

Commit

Permalink
Fixed UCI TB win values
Browse files Browse the repository at this point in the history
This patch results in search values for a TB win/loss to be reported in a way that does not change with normalization, i.e. will be consistent over time.

A value of 200.00 pawns is now reported upon entering a TB won position. Values smaller than 200.00 relate to the distance in plies from the root to the probed position position,
with 1 cp being 1 ply distance.

closes #4353

No functional change
  • Loading branch information
Disservin authored and vondele committed Jan 28, 2023
1 parent d3860f8 commit def2966
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/uci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,13 @@ string UCI::value(Value v) {

stringstream ss;

if (abs(v) < VALUE_MATE_IN_MAX_PLY)
if (abs(v) < VALUE_TB_WIN_IN_MAX_PLY)
ss << "cp " << v * 100 / NormalizeToPawnValue;
else if (abs(v) < VALUE_MATE_IN_MAX_PLY)
{
const int ply = VALUE_MATE_IN_MAX_PLY - 1 - std::abs(v); // recompute ss->ply
ss << "cp " << (v > 0 ? 20000 - ply : -20000 + ply);
}
else
ss << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;

Expand Down

0 comments on commit def2966

Please sign in to comment.