Skip to content

Commit def2966

Browse files
Disservinvondele
authored andcommitted
Fixed UCI TB win values
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
1 parent d3860f8 commit def2966

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/uci.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,13 @@ string UCI::value(Value v) {
314314

315315
stringstream ss;
316316

317-
if (abs(v) < VALUE_MATE_IN_MAX_PLY)
317+
if (abs(v) < VALUE_TB_WIN_IN_MAX_PLY)
318318
ss << "cp " << v * 100 / NormalizeToPawnValue;
319+
else if (abs(v) < VALUE_MATE_IN_MAX_PLY)
320+
{
321+
const int ply = VALUE_MATE_IN_MAX_PLY - 1 - std::abs(v); // recompute ss->ply
322+
ss << "cp " << (v > 0 ? 20000 - ply : -20000 + ply);
323+
}
319324
else
320325
ss << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;
321326

0 commit comments

Comments
 (0)