mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Retire Search Log
No functional change Bench: 7461881
This commit is contained in:
parent
8b8885ab07
commit
877313a413
4 changed files with 0 additions and 106 deletions
|
@ -18,9 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iomanip>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stack>
|
|
||||||
|
|
||||||
#include "movegen.h"
|
#include "movegen.h"
|
||||||
#include "notation.h"
|
#include "notation.h"
|
||||||
|
@ -95,68 +93,3 @@ Move move_from_uci(const Position& pos, string& str) {
|
||||||
|
|
||||||
return MOVE_NONE;
|
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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ class Position;
|
||||||
std::string score_to_uci(Value v, Value alpha = -VALUE_INFINITE, Value beta = VALUE_INFINITE);
|
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);
|
Move move_from_uci(const Position& pos, std::string& str);
|
||||||
const std::string move_to_uci(Move m, bool chess960);
|
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) {
|
inline char to_char(File f, bool tolower = true) {
|
||||||
return char(f - FILE_A + (tolower ? 'a' : 'A'));
|
return char(f - FILE_A + (tolower ? 'a' : 'A'));
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cfloat>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -202,18 +201,6 @@ void Search::think() {
|
||||||
goto finalize;
|
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
|
// Reset the threads, still sleeping: will wake up at split time
|
||||||
for (size_t i = 0; i < Threads.size(); ++i)
|
for (size_t i = 0; i < Threads.size(); ++i)
|
||||||
Threads[i]->maxPly = 0;
|
Threads[i]->maxPly = 0;
|
||||||
|
@ -225,18 +212,6 @@ void Search::think() {
|
||||||
|
|
||||||
Threads.timer->run = false; // Stop the timer
|
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:
|
finalize:
|
||||||
|
|
||||||
// When search is stopped this info is not printed
|
// When search is stopped this info is not printed
|
||||||
|
@ -378,17 +353,6 @@ namespace {
|
||||||
if (skill.candidates_size() && skill.time_to_pick(depth))
|
if (skill.candidates_size() && skill.time_to_pick(depth))
|
||||||
skill.pick_move();
|
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"?
|
// Have we found a "mate in x"?
|
||||||
if ( Limits.mate
|
if ( Limits.mate
|
||||||
&& bestValue >= VALUE_MATE_IN_MAX_PLY
|
&& bestValue >= VALUE_MATE_IN_MAX_PLY
|
||||||
|
|
|
@ -55,8 +55,6 @@ bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const
|
||||||
void init(OptionsMap& o) {
|
void init(OptionsMap& o) {
|
||||||
|
|
||||||
o["Write Debug Log"] << Option(false, on_logger);
|
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["Contempt Factor"] << Option(0, -100, 100);
|
||||||
o["Min Split Depth"] << Option(0, 0, 12, on_threads);
|
o["Min Split Depth"] << Option(0, 0, 12, on_threads);
|
||||||
o["Threads"] << Option(1, 1, MAX_THREADS, on_threads);
|
o["Threads"] << Option(1, 1, MAX_THREADS, on_threads);
|
||||||
|
|
Loading…
Add table
Reference in a new issue