From 877313a413314f8ccca32d96cf3b802a96b52e8a Mon Sep 17 00:00:00 2001 From: lucasart Date: Sun, 24 Aug 2014 16:28:51 +0100 Subject: [PATCH] Retire Search Log No functional change Bench: 7461881 --- src/notation.cpp | 67 ----------------------------------------------- src/notation.h | 1 - src/search.cpp | 36 ------------------------- src/ucioption.cpp | 2 -- 4 files changed, 106 deletions(-) diff --git a/src/notation.cpp b/src/notation.cpp index 3686016b..a2d898ad 100644 --- a/src/notation.cpp +++ b/src/notation.cpp @@ -18,9 +18,7 @@ */ #include -#include #include -#include #include "movegen.h" #include "notation.h" @@ -95,68 +93,3 @@ Move move_from_uci(const Position& pos, string& str) { return MOVE_NONE; } - - -/// pretty_pv() formats human-readable search information, typically to be -/// appended to the search log file. It uses the two helpers below to pretty -/// format the time and score respectively. - -static string format(int64_t msecs) { - - const int MSecMinute = 1000 * 60; - const int MSecHour = 1000 * 60 * 60; - - int64_t hours = msecs / MSecHour; - int64_t minutes = (msecs % MSecHour) / MSecMinute; - int64_t seconds = ((msecs % MSecHour) % MSecMinute) / 1000; - - stringstream ss; - - if (hours) - ss << hours << ':'; - - ss << setfill('0') << setw(2) << minutes << ':' << setw(2) << seconds; - - return ss.str(); -} - -static string format(Value v) { - - stringstream ss; - - if (v >= VALUE_MATE_IN_MAX_PLY) - ss << "#" << (VALUE_MATE - v + 1) / 2; - - else if (v <= VALUE_MATED_IN_MAX_PLY) - ss << "-#" << (VALUE_MATE + v) / 2; - - else - ss << setprecision(2) << fixed << showpos << double(v) / PawnValueEg; - - return ss.str(); -} - -string pretty_pv(const Position& pos, int depth, Value value, int64_t msecs, Move pv[]) { - - const uint64_t K = 1000; - const uint64_t M = 1000000; - - stringstream ss; - ss << setw(2) << depth << setw(8) << format(value) << setw(8) << format(msecs); - - if (pos.nodes_searched() < M) - ss << setw(8) << pos.nodes_searched() / 1 << " "; - - else if (pos.nodes_searched() < K * M) - ss << setw(7) << pos.nodes_searched() / K << "K "; - - else - ss << setw(7) << pos.nodes_searched() / M << "M "; - - string str = ss.str(); - - for (Move *m = pv; *m != MOVE_NONE; m++) - str += move_to_uci(*m, pos.is_chess960()) + ' '; - - return str; -} diff --git a/src/notation.h b/src/notation.h index a77b0f09..251a0caf 100644 --- a/src/notation.h +++ b/src/notation.h @@ -29,7 +29,6 @@ class Position; std::string score_to_uci(Value v, Value alpha = -VALUE_INFINITE, Value beta = VALUE_INFINITE); Move move_from_uci(const Position& pos, std::string& str); const std::string move_to_uci(Move m, bool chess960); -std::string pretty_pv(const Position& pos, int depth, Value score, int64_t msecs, Move pv[]); inline char to_char(File f, bool tolower = true) { return char(f - FILE_A + (tolower ? 'a' : 'A')); diff --git a/src/search.cpp b/src/search.cpp index c7eb5f9a..7ce54521 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -202,18 +201,6 @@ void Search::think() { goto finalize; } - if (Options["Write Search Log"]) - { - Log log(Options["Search Log Filename"]); - log << "\nSearching: " << RootPos.fen() - << "\ninfinite: " << Limits.infinite - << " ponder: " << Limits.ponder - << " time: " << Limits.time[RootPos.side_to_move()] - << " increment: " << Limits.inc[RootPos.side_to_move()] - << " moves to go: " << Limits.movestogo - << "\n" << std::endl; - } - // Reset the threads, still sleeping: will wake up at split time for (size_t i = 0; i < Threads.size(); ++i) Threads[i]->maxPly = 0; @@ -225,18 +212,6 @@ void Search::think() { Threads.timer->run = false; // Stop the timer - if (Options["Write Search Log"]) - { - Time::point elapsed = Time::now() - SearchTime + 1; - - Log log(Options["Search Log Filename"]); - log << "Nodes: " << RootPos.nodes_searched() - << "\nNodes/second: " << RootPos.nodes_searched() * 1000 / elapsed - << "\nBest move: " << move_to_uci(RootMoves[0].pv[0], RootPos.is_chess960()) - << "\nPonder move: " << move_to_uci(RootMoves[0].pv[1], RootPos.is_chess960()) - << std::endl; - } - finalize: // When search is stopped this info is not printed @@ -378,17 +353,6 @@ namespace { if (skill.candidates_size() && skill.time_to_pick(depth)) skill.pick_move(); - if (Options["Write Search Log"]) - { - RootMove& rm = RootMoves[0]; - if (skill.best != MOVE_NONE) - rm = *std::find(RootMoves.begin(), RootMoves.end(), skill.best); - - Log log(Options["Search Log Filename"]); - log << pretty_pv(pos, depth, rm.score, Time::now() - SearchTime, &rm.pv[0]) - << std::endl; - } - // Have we found a "mate in x"? if ( Limits.mate && bestValue >= VALUE_MATE_IN_MAX_PLY diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 89b983f8..3329a468 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -55,8 +55,6 @@ bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const void init(OptionsMap& o) { o["Write Debug Log"] << Option(false, on_logger); - o["Write Search Log"] << Option(false); - o["Search Log Filename"] << Option("SearchLog.txt"); o["Contempt Factor"] << Option(0, -100, 100); o["Min Split Depth"] << Option(0, 0, 12, on_threads); o["Threads"] << Option(1, 1, MAX_THREADS, on_threads); -- 2.39.2