17 }
else if (args ==
"off") {
22 }
else if (args ==
"show fen") {
24 }
else if (args ==
"help") {
26 }
else if (args ==
"gamehistory") {
27 App().
bout << show_gamehistory();
28 }
else if (args ==
"fenhistory") {
29 App().
bout << show_fenhistory();
30 }
else if (args ==
"poshistory") {
31 App().
bout << show_poshistory();
32 }
else if (args ==
"hashhistory") {
33 App().
bout << show_hashhistory();
34 }
else if (args ==
"autosave") {
35 App().
bout <<
"not implemented yet \n";
36 }
else if (args ==
"logging") {
37 App().
bout <<
"not implemented yet \n";
38 }
else if (args ==
"ml") {
43 App().
bout <<
"info string ml " << ml <<
"\n";
44 App().
bout <<
"info string ml " << pml <<
"\n";
45 }
else if (args ==
"sortmoves") {
51 App().
bout <<
"info string ml " << ml <<
"\n";
52 App().
bout <<
"info string ml " << pml <<
"\n";
53 }
else if (args ==
"setrunning") {
55 }
else if (args ==
"invert") {
57 }
else if (args ==
"log on") {
59 }
else if (args ==
"log off") {
61 }
else if (args ==
"verbose 0") {
64 }
else if (args ==
"verbose 1") {
66 }
else if (args ==
"verbose 2") {
68 }
else if (args ==
"verbose 3") {
70 }
else if (args ==
"verbose 4") {
72 }
else if (args ==
"verbose all") {
74 }
else if (args ==
"") {
87#if defined(CHRONO_MISSING)
88 App().
bout <<
" CHRONO_MISSING";
90#if defined(BELOFTE_NORANDOM)
91 App().
bout <<
" BELOFTE_NORANDOM";
93#if defined(BELOFTE_UCIMODE)
94 App().
bout <<
" BELOFTE_UCIMODE";
96#if defined(BELOFTE_NOSIGNALS)
97 App().
bout <<
" BELOFTE_NOSIGNALS";
99#if defined(BELOFTE_NOUNICODE)
100 App().
bout <<
" BELOFTE_NOUNICODE";
102#if defined(INCOMPLETE_C11)
103 App().
bout <<
" INCOMPLETE_C11";
108#if defined(_WIN32) || defined(WIN32)
119 App().
bout <<
"Output detail -"
126 <<
"Mode: " <<
AppEI()->operator std::string() <<
"\n"
127 <<
"Eval: " <<
Game()->
getEval()->operator std::string()
139 int64_t nNonLeafNodes;
150 Game()->
setFEN(
"n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1");
155 std::stringstream ss;
156 ss <<
"bench " << search.operator std::string()
161 <<
" NPS: " <<
belofte::to_string(
static_cast<int64_t
>((nNonLeafNodes + nNodes) * 1000000LL / nDuration))
168std::string bel_debug::show_help()
const
170 std::stringstream os;
171 os <<
"debug help - this message" <<
"\n"
172 <<
"debug [off|on] - set level 50, 0 or 99" <<
"\n"
173 <<
"debug verbose n - set level n (can be 0-5)" <<
"\n"
174 <<
"debug verbose all - set level 99" <<
"\n"
175 <<
"debug log on - activate logfile" <<
"\n"
176 <<
"debug log off - de-activate logfile" <<
"\n"
177 <<
"debug show fen - display FEN string of current position" <<
"\n"
178 <<
"debug ml - show moves calculated for current position" <<
"\n"
179 <<
"debug sortmoves - sort moves and show moves calculated" <<
"\n"
180 <<
"debug invert - invert colours" <<
"\n"
181 <<
"debug gamehistory - show complete game" <<
"\n"
182 <<
"debug fenhistory - show all fen strings of game" <<
"\n"
183 <<
"debug poshistory - show positions of game" <<
"\n"
184 <<
"debug setrunning - set xboard persistent running state" <<
"\n";
189std::string bel_debug::show_gamehistory()
const
191 std::stringstream os;
194 for (bBoard
const& b : positions) {
199 os << b.getFEN() <<
"\n"
208std::string bel_debug::show_poshistory()
const
210 std::stringstream os;
213 for (bBoard
const& b : positions) {
220std::string bel_debug::show_fenhistory()
const
222 std::stringstream os;
225 for (bBoard
const& b : positions) {
226 os << b.getFEN() <<
"\n";
232std::string bel_debug::show_hashhistory()
const
234 std::stringstream os;
237 for (bBoard
const& b : positions) {
238 os << b.getHashStr() <<
" : " << b.getFEN() <<
"\n";
252#pragma GCC diagnostic push
253#pragma GCC diagnostic ignored "-Wunused-parameter"
264#pragma GCC diagnostic pop
272 m_fos.open(
fn.c_str(), std::ios::out | std::ios::trunc );
273 if (m_fos.is_open()) {
277 return m_fos.is_open();
engineInterface * AppEI()
This is the main include file, needs to be included before any other include.
long long getDurationMicroSec() const
outputWriter sout
normal output
int64_t getConfig(std::string const &s, int64_t v)
std::string getName() const
void invertColours()
invert colours update kingpos, update colour to move, castle rights, ...
bSearchAlgorithm * getAlgorithm() const
bPositionEvaluation * getEval() const
int64_t DoPerft(bSearchAlgorithm &sa, depth_t const d)
do perft search at depth in case of Perft algorithm, temporarily set evaltype to None
positions_t & getPositions()
void setFEN(std::string const &fenstr)
bBoard & getCurrentPosition()
movenum_t generateMoves(bBasicBoard const &b)
generate moves if not yet generated
void sortMoves()
sort moves and update bestmove id if less than 5 moves, sort all if more than 5 moves,...
constexpr int64_t getNonLeafNodes() const
static void run_bench(bSearchAlgorithm &search, depth_t const nDepth)
void execute(std::string const &args)
virtual void setRunning(bool const r)
virtual void sendError(std::string const &error, std::string const &description)
outputWriter(std::ostream &os)
Outputwriter class will log to debug file, stdout and log file in this order if they have been initia...
std::string const & fn() const
bool attach(std::string const &fn)
void setLevel(int const l)
std::vector< bBoard > positions_t
std::string to_string(int16_t value)
std::to_string not compatible on Mac OS (Apple LLVM version 5.0) provide generic utility function
std::string prettyTime(long const t)