]> git.sesse.net Git - stockfish/commitdiff
Fixed UCI TB win values
authordisservin <disservin.social@gmail.com>
Mon, 23 Jan 2023 18:32:26 +0000 (19:32 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sat, 28 Jan 2023 15:37:29 +0000 (16:37 +0100)
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 https://github.com/official-stockfish/Stockfish/pull/4353

No functional change

src/uci.cpp

index 30c1fa0cce0cfc448dc4cf96ae78684c324f4a0e..2afd2de730049b5fd018eda7a52fc789da4ecb79 100644 (file)
@@ -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;