]> git.sesse.net Git - stockfish/blobdiff - src/uci.cpp
Fix TB score output in UCI without using TB
[stockfish] / src / uci.cpp
index 8139fae4fd8be84099af2e1eae1c103aa4f8ae59..d0341bd71683a173e8096317cfa1b5e46405bfb4 100644 (file)
@@ -82,8 +82,8 @@ void position(Position& pos, std::istringstream& is, StateListPtr& states) {
     }
 }
 
-// Prints the evaluation of the current position, consistent with
-// the UCI options set so far.
+// Prints the evaluation of the current position,
+// consistent with the UCI options set so far.
 void trace_eval(Position& pos) {
 
     StateListPtr states(new std::deque<StateInfo>(1));
@@ -122,9 +122,8 @@ void setoption(std::istringstream& is) {
 }
 
 
-// Called when the engine receives the "go" UCI command. The function
-// sets the thinking time and other parameters from the input string, then starts
-// with a search.
+// Called when the engine receives the "go" UCI command. The function sets the
+// thinking time and other parameters from the input string then stars with a search
 
 void go(Position& pos, std::istringstream& is, StateListPtr& states) {
 
@@ -357,9 +356,9 @@ std::string UCI::value(Value v) {
 
     if (abs(v) < VALUE_TB_WIN_IN_MAX_PLY)
         ss << "cp " << UCI::to_cp(v);
-    else if (abs(v) < VALUE_MATE_IN_MAX_PLY)
+    else if (abs(v) <= VALUE_TB)
     {
-        const int ply = VALUE_MATE_IN_MAX_PLY - 1 - std::abs(v);  // recompute ss->ply
+        const int ply = VALUE_TB - std::abs(v);  // recompute ss->ply
         ss << "cp " << (v > 0 ? 20000 - ply : -20000 + ply);
     }
     else