]> git.sesse.net Git - stockfish/commitdiff
Fix score_to_uci()
authorMarco Costalba <mcostalba@gmail.com>
Wed, 28 Dec 2011 13:18:56 +0000 (14:18 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 28 Dec 2011 13:20:24 +0000 (14:20 +0100)
The condition for a mate score was wrong:

abs(v) < VALUE_MATE - PLY_MAX * ONE_PLY

instead of

abs(v) < VALUE_MATE_IN_PLY_MAX

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index f976908ec31b0e5b2a9f9d36235b365461a3d9e7..636ebd8ef6654b4a31f325b752ca5e1d0dceab53 100644 (file)
@@ -410,10 +410,10 @@ namespace {
     bestValue = delta = -VALUE_INFINITE;
     ss->currentMove = MOVE_NULL; // Hack to skip update gains
 
     bestValue = delta = -VALUE_INFINITE;
     ss->currentMove = MOVE_NULL; // Hack to skip update gains
 
-    // Handle the special case of a mate/stalemate position
+    // Handle the special case of a mated/stalemate position
     if (RootMoves.empty())
     {
     if (RootMoves.empty())
     {
-        cout << "info depth 0"
+        cout << "info depth 0 score "
              << score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW) << endl;
 
         RootMoves.push_back(MOVE_NONE);
              << score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW) << endl;
 
         RootMoves.push_back(MOVE_NONE);
@@ -1624,10 +1624,10 @@ split_point_start: // At split points actual search starts from here
 
     std::stringstream s;
 
 
     std::stringstream s;
 
-    if (abs(v) < VALUE_MATE - PLY_MAX * ONE_PLY)
-        s << " score cp " << int(v) * 100 / int(PawnValueMidgame); // Scale to centipawns
+    if (abs(v) < VALUE_MATE_IN_PLY_MAX)
+        s << "cp " << v * 100 / int(PawnValueMidgame);
     else
     else
-        s << " score mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;
+        s << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;
 
     s << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : "");
 
 
     s << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : "");
 
@@ -1664,7 +1664,7 @@ split_point_start: // At split points actual search starts from here
 
         cout << "info depth " << d
              << " seldepth " << selDepth
 
         cout << "info depth " << d
              << " seldepth " << selDepth
-             << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
+             << " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
              << " nodes " << pos.nodes_searched()
              << " nps " << (t > 0 ? pos.nodes_searched() * 1000 / t : 0)
              << " time " << t
              << " nodes " << pos.nodes_searched()
              << " nps " << (t > 0 ? pos.nodes_searched() * 1000 / t : 0)
              << " time " << t