]> git.sesse.net Git - stockfish/commitdiff
Don't set Search::RootColor in Eval::trace
authorMarco Costalba <mcostalba@gmail.com>
Sun, 11 Aug 2013 05:02:50 +0000 (07:02 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 11 Aug 2013 05:02:50 +0000 (07:02 +0200)
Search::RootColor is a global parameter set
before to start a search, it is not something
trace() should change.

This patch allows to add trace() calls, for
debugging, inside search itself without altering
the bench, and also ensures that the values
returned by trace() and evaluate() are fully
equivalent.

No functional change.

src/evaluate.cpp
src/uci.cpp

index 147a1b3e90b5eb788fcbcdbb359f08792b91c293..70c91f8ae7a877d2ffdf6efbf6395120835c2ce9 100644 (file)
@@ -1140,8 +1140,6 @@ Value do_evaluate(const Position& pos, Value& margin) {
 
   std::string Tracing::do_trace(const Position& pos) {
 
 
   std::string Tracing::do_trace(const Position& pos) {
 
-    Search::RootColor = pos.side_to_move();
-
     stream.str("");
     stream << std::showpoint << std::showpos << std::fixed << std::setprecision(2);
     std::memset(scores, 0, 2 * (TOTAL + 1) * sizeof(Score));
     stream.str("");
     stream << std::showpoint << std::showpos << std::fixed << std::setprecision(2);
     std::memset(scores, 0, 2 * (TOTAL + 1) * sizeof(Score));
index 95d050f3bcaa66b624f159bc144ebfd4cf974f18..395b78a813bf4e9342a14ba44f7ef78e3ba9f6aa 100644 (file)
@@ -103,6 +103,11 @@ void UCI::loop(const string& args) {
                     << "\n"       << Options
                     << "\nuciok"  << sync_endl;
 
                     << "\n"       << Options
                     << "\nuciok"  << sync_endl;
 
+      else if (token == "eval")
+      {
+          Search::RootColor = pos.side_to_move(); // Ensure it is set
+          sync_cout << Eval::trace(pos) << sync_endl;
+      }
       else if (token == "ucinewgame") TT.clear();
       else if (token == "go")         go(pos, is);
       else if (token == "position")   position(pos, is);
       else if (token == "ucinewgame") TT.clear();
       else if (token == "go")         go(pos, is);
       else if (token == "position")   position(pos, is);
@@ -111,7 +116,6 @@ void UCI::loop(const string& args) {
       else if (token == "bench")      benchmark(pos, is);
       else if (token == "d")          sync_cout << pos.pretty() << sync_endl;
       else if (token == "isready")    sync_cout << "readyok" << sync_endl;
       else if (token == "bench")      benchmark(pos, is);
       else if (token == "d")          sync_cout << pos.pretty() << sync_endl;
       else if (token == "isready")    sync_cout << "readyok" << sync_endl;
-      else if (token == "eval")       sync_cout << Eval::trace(pos) << sync_endl;
       else
           sync_cout << "Unknown command: " << cmd << sync_endl;
 
       else
           sync_cout << "Unknown command: " << cmd << sync_endl;