diff --git a/src/position.cpp b/src/position.cpp index 97599806..d75a75f8 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -31,6 +31,7 @@ #include "thread.h" #include "tt.h" #include "uci.h" +#include "syzygy/tbprobe.h" using std::string; @@ -102,7 +103,7 @@ CheckInfo::CheckInfo(const Position& pos) { /// operator<<(Position) returns an ASCII representation of the position -std::ostream& operator<<(std::ostream& os, const Position& pos) { +std::ostream& operator<<(std::ostream& os, Position& pos) { os << "\n +---+---+---+---+---+---+---+---+\n"; @@ -115,11 +116,22 @@ std::ostream& operator<<(std::ostream& os, const Position& pos) { } os << "\nFen: " << pos.fen() << "\nKey: " << std::hex << std::uppercase - << std::setfill('0') << std::setw(16) << pos.key() << std::dec << "\nCheckers: "; + << std::setfill('0') << std::setw(16) << pos.key() + << std::setfill(' ') << std::dec << "\nCheckers: "; for (Bitboard b = pos.checkers(); b; ) os << UCI::square(pop_lsb(&b)) << " "; + if ( int(Tablebases::MaxCardinality) >= popcount(pos.pieces()) + && !pos.can_castle(ANY_CASTLING)) + { + Tablebases::ProbeState s1, s2; + Tablebases::WDLScore wdl = Tablebases::probe_wdl(pos, &s1); + int dtz = Tablebases::probe_dtz(pos, &s2); + os << "\nTablebases WDL: " << std::setw(4) << wdl << " (" << s1 << ")" + << "\nTablebases DTZ: " << std::setw(4) << dtz << " (" << s2 << ")"; + } + return os; } diff --git a/src/position.h b/src/position.h index 46f1bc30..62095480 100644 --- a/src/position.h +++ b/src/position.h @@ -212,7 +212,7 @@ private: bool chess960; }; -extern std::ostream& operator<<(std::ostream& os, const Position& pos); +extern std::ostream& operator<<(std::ostream& os, Position& pos); inline Color Position::side_to_move() const { return sideToMove; diff --git a/src/syzygy/tbprobe.h b/src/syzygy/tbprobe.h index c24af571..6785c815 100644 --- a/src/syzygy/tbprobe.h +++ b/src/syzygy/tbprobe.h @@ -68,7 +68,7 @@ inline std::ostream& operator<<(std::ostream& os, const ProbeState v) { os << (v == FAIL ? "Failed" : v == OK ? "Success" : v == CHANGE_STM ? "Probed opponent side" : - v == ZEROING_BEST_MOVE ? "Missing DTZ value" : "None"); + v == ZEROING_BEST_MOVE ? "Best move zeroes DTZ" : "None"); return os; } diff --git a/src/uci.cpp b/src/uci.cpp index 6e479497..a9811a9a 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -29,7 +29,6 @@ #include "thread.h" #include "timeman.h" #include "uci.h" -#include "syzygy/tbprobe.h" using namespace std; @@ -189,18 +188,6 @@ void UCI::loop(int argc, char* argv[]) { Search::clear(); Time.availableNodes = 0; } - else if (token == "wdl") - { - Tablebases::ProbeState err; - Tablebases::WDLScore v = Tablebases::probe_wdl(pos, &err); - sync_cout << v << " (" << err << ")" << sync_endl; - } - else if (token == "dtz") - { - Tablebases::ProbeState err; - int dtz = Tablebases::probe_dtz(pos, &err); - sync_cout << dtz << " (" << err << ")" << sync_endl; - } else if (token == "isready") sync_cout << "readyok" << sync_endl; else if (token == "go") go(pos, is); else if (token == "position") position(pos, is);