]> git.sesse.net Git - stockfish/commitdiff
Show evaluation from white POV in trace
authorMarco Costalba <mcostalba@gmail.com>
Sun, 30 Mar 2014 08:11:32 +0000 (10:11 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 30 Mar 2014 08:45:46 +0000 (10:45 +0200)
We chose this instead of negamax sign convention
(ie. from the point of view of the side to move)
because it is more in line to how the eval
table is presented.

Also some tweak to formatting while there.

No functional change.

src/evaluate.cpp

index 8c84ac299777e7ff7a33f91cb2f9e439de783686..fd78d5af368d2aa3f1b03a1a08882a45c7f8e83b 100644 (file)
@@ -967,8 +967,8 @@ Value do_evaluate(const Position& pos) {
     switch (idx) {
     case PST: case IMBALANCE: case PAWN: case TOTAL:
         ss << std::setw(20) << name << " |   ---   --- |   ---   --- | "
     switch (idx) {
     case PST: case IMBALANCE: case PAWN: case TOTAL:
         ss << std::setw(20) << name << " |   ---   --- |   ---   --- | "
-           << std::setw(6)  << to_cp(mg_value(wScore - bScore)) << " "
-           << std::setw(6)  << to_cp(eg_value(wScore - bScore)) << " \n";
+           << std::setw(5)  << to_cp(mg_value(wScore - bScore)) << " "
+           << std::setw(5)  << to_cp(eg_value(wScore - bScore)) << " \n";
         break;
     default:
         ss << std::setw(20) << name << " | " << std::noshowpos
         break;
     default:
         ss << std::setw(20) << name << " | " << std::noshowpos
@@ -976,9 +976,8 @@ Value do_evaluate(const Position& pos) {
            << std::setw(5)  << to_cp(eg_value(wScore)) << " | "
            << std::setw(5)  << to_cp(mg_value(bScore)) << " "
            << std::setw(5)  << to_cp(eg_value(bScore)) << " | "
            << std::setw(5)  << to_cp(eg_value(wScore)) << " | "
            << std::setw(5)  << to_cp(mg_value(bScore)) << " "
            << std::setw(5)  << to_cp(eg_value(bScore)) << " | "
-           << std::showpos
-           << std::setw(6)  << to_cp(mg_value(wScore - bScore)) << " "
-           << std::setw(6)  << to_cp(eg_value(wScore - bScore)) << " \n";
+           << std::setw(5)  << to_cp(mg_value(wScore - bScore)) << " "
+           << std::setw(5)  << to_cp(eg_value(wScore - bScore)) << " \n";
     }
   }
 
     }
   }
 
@@ -987,12 +986,13 @@ Value do_evaluate(const Position& pos) {
     std::memset(terms, 0, sizeof(terms));
 
     Value v = do_evaluate<true>(pos);
     std::memset(terms, 0, sizeof(terms));
 
     Value v = do_evaluate<true>(pos);
+    v = pos.side_to_move() == WHITE ? v : -v; // White's point of view
 
     std::stringstream ss;
 
     std::stringstream ss;
-    ss << std::showpoint << std::showpos << std::fixed << std::setprecision(2)
-       << "           Eval term |    White    |    Black    |     Total     \n"
-       << "                     |   MG    EG  |   MG    EG  |   MG     EG   \n"
-       << "---------------------+-------------+-------------+---------------\n";
+    ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2)
+       << "           Eval term |    White    |    Black    |    Total    \n"
+       << "                     |   MG    EG  |   MG    EG  |   MG    EG  \n"
+       << "---------------------+-------------+-------------+-------------\n";
 
     format_row(ss, "Material, PST, Tempo", PST);
     format_row(ss, "Material imbalance", IMBALANCE);
 
     format_row(ss, "Material, PST, Tempo", PST);
     format_row(ss, "Material imbalance", IMBALANCE);
@@ -1007,14 +1007,10 @@ Value do_evaluate(const Position& pos) {
     format_row(ss, "Passed pawns", PASSED);
     format_row(ss, "Space", SPACE);
 
     format_row(ss, "Passed pawns", PASSED);
     format_row(ss, "Space", SPACE);
 
-    ss << "---------------------+-------------+-------------+---------------\n";
+    ss << "---------------------+-------------+-------------+-------------\n";
     format_row(ss, "Total", TOTAL);
 
     format_row(ss, "Total", TOTAL);
 
-    ss << "\nScaling: " << std::noshowpos
-       << std::setw(6) << 100.0 * ei.mi->game_phase() / 128.0 << "% MG, "
-       << std::setw(6) << 100.0 * (1.0 - ei.mi->game_phase() / 128.0) << "% * "
-       << std::setw(6) << (100.0 * sf) / SCALE_FACTOR_NORMAL << "% EG.\n"
-       << "Total evaluation: " << to_cp(v);
+    ss << "\nTotal Evaluation: " << to_cp(v) << " (white side)\n";
 
     return ss.str();
   }
 
     return ss.str();
   }