mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Don't set Search::RootColor in Eval::trace
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.
This commit is contained in:
parent
94a3608ab9
commit
15616ad199
2 changed files with 5 additions and 3 deletions
|
@ -1140,8 +1140,6 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
|||
|
||||
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));
|
||||
|
|
|
@ -103,6 +103,11 @@ void UCI::loop(const string& args) {
|
|||
<< "\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);
|
||||
|
@ -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 == "eval") sync_cout << Eval::trace(pos) << sync_endl;
|
||||
else
|
||||
sync_cout << "Unknown command: " << cmd << sync_endl;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue