1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Move 'wdl' and 'dtz' UCI commands under 'd'

This commit is contained in:
Marco Costalba 2016-05-27 08:28:40 +02:00
parent c77a13ef4a
commit ac65186fa9
4 changed files with 16 additions and 17 deletions

View file

@ -31,6 +31,7 @@
#include "thread.h" #include "thread.h"
#include "tt.h" #include "tt.h"
#include "uci.h" #include "uci.h"
#include "syzygy/tbprobe.h"
using std::string; using std::string;
@ -102,7 +103,7 @@ CheckInfo::CheckInfo(const Position& pos) {
/// operator<<(Position) returns an ASCII representation of the position /// 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"; 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 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; ) for (Bitboard b = pos.checkers(); b; )
os << UCI::square(pop_lsb(&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; return os;
} }

View file

@ -212,7 +212,7 @@ private:
bool chess960; 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 { inline Color Position::side_to_move() const {
return sideToMove; return sideToMove;

View file

@ -68,7 +68,7 @@ inline std::ostream& operator<<(std::ostream& os, const ProbeState v) {
os << (v == FAIL ? "Failed" : os << (v == FAIL ? "Failed" :
v == OK ? "Success" : v == OK ? "Success" :
v == CHANGE_STM ? "Probed opponent side" : 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; return os;
} }

View file

@ -29,7 +29,6 @@
#include "thread.h" #include "thread.h"
#include "timeman.h" #include "timeman.h"
#include "uci.h" #include "uci.h"
#include "syzygy/tbprobe.h"
using namespace std; using namespace std;
@ -189,18 +188,6 @@ void UCI::loop(int argc, char* argv[]) {
Search::clear(); Search::clear();
Time.availableNodes = 0; 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 == "isready") sync_cout << "readyok" << sync_endl;
else if (token == "go") go(pos, is); else if (token == "go") go(pos, is);
else if (token == "position") position(pos, is); else if (token == "position") position(pos, is);