|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TBPROBE_H |
|
#define TBPROBE_H |
|
|
|
#include <ostream> |
|
|
|
#include "../search.h" |
|
|
|
namespace Stockfish::Tablebases { |
|
|
|
enum WDLScore { |
|
WDLLoss = -2, |
|
WDLBlessedLoss = -1, |
|
WDLDraw = 0, |
|
WDLCursedWin = 1, |
|
WDLWin = 2, |
|
}; |
|
|
|
|
|
enum ProbeState { |
|
FAIL = 0, |
|
OK = 1, |
|
CHANGE_STM = -1, |
|
ZEROING_BEST_MOVE = 2 |
|
}; |
|
|
|
extern int MaxCardinality; |
|
|
|
void init(const std::string& paths); |
|
WDLScore probe_wdl(Position& pos, ProbeState* result); |
|
int probe_dtz(Position& pos, ProbeState* result); |
|
bool root_probe(Position& pos, Search::RootMoves& rootMoves); |
|
bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves); |
|
void rank_root_moves(Position& pos, Search::RootMoves& rootMoves); |
|
|
|
inline std::ostream& operator<<(std::ostream& os, const WDLScore v) { |
|
|
|
os << (v == WDLLoss ? "Loss" : |
|
v == WDLBlessedLoss ? "Blessed loss" : |
|
v == WDLDraw ? "Draw" : |
|
v == WDLCursedWin ? "Cursed win" : |
|
v == WDLWin ? "Win" : "None"); |
|
|
|
return os; |
|
} |
|
|
|
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 ? "Best move zeroes DTZ" : "None"); |
|
|
|
return os; |
|
} |
|
|
|
} |
|
|
|
#endif |
|
|