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

Provide more info on found TB files

now uses the following format:

`info string Found 510 WDL and 510 DTZ tablebase files (up to 6-man).`

this clarifies exactly what has been found, as the difference matters,
e.g. for the PV extension of TB scores.

closes https://github.com/official-stockfish/Stockfish/pull/5471

No functional change
This commit is contained in:
Joost VandeVondele 2024-07-10 21:13:59 +02:00
parent 7e72b37e4c
commit 6135a0e2f8

View file

@ -443,6 +443,8 @@ class TBTables {
std::deque<TBTable<WDL>> wdlTable; std::deque<TBTable<WDL>> wdlTable;
std::deque<TBTable<DTZ>> dtzTable; std::deque<TBTable<DTZ>> dtzTable;
size_t foundDTZFiles = 0;
size_t foundWDLFiles = 0;
void insert(Key key, TBTable<WDL>* wdl, TBTable<DTZ>* dtz) { void insert(Key key, TBTable<WDL>* wdl, TBTable<DTZ>* dtz) {
uint32_t homeBucket = uint32_t(key) & (Size - 1); uint32_t homeBucket = uint32_t(key) & (Size - 1);
@ -486,9 +488,16 @@ class TBTables {
memset(hashTable, 0, sizeof(hashTable)); memset(hashTable, 0, sizeof(hashTable));
wdlTable.clear(); wdlTable.clear();
dtzTable.clear(); dtzTable.clear();
foundDTZFiles = 0;
foundWDLFiles = 0;
} }
size_t size() const { return wdlTable.size(); }
void add(const std::vector<PieceType>& pieces); void info() const {
sync_cout << "info string Found " << foundWDLFiles << " WDL and " << foundDTZFiles
<< " DTZ tablebase files (up to " << MaxCardinality << "-man)." << sync_endl;
}
void add(const std::vector<PieceType>& pieces);
}; };
TBTables TBTables; TBTables TBTables;
@ -501,13 +510,22 @@ void TBTables::add(const std::vector<PieceType>& pieces) {
for (PieceType pt : pieces) for (PieceType pt : pieces)
code += PieceToChar[pt]; code += PieceToChar[pt];
code.insert(code.find('K', 1), "v");
TBFile file(code.insert(code.find('K', 1), "v") + ".rtbw"); // KRK -> KRvK TBFile file_dtz(code + ".rtbz"); // KRK -> KRvK
if (file_dtz.is_open())
{
file_dtz.close();
foundDTZFiles++;
}
TBFile file(code + ".rtbw"); // KRK -> KRvK
if (!file.is_open()) // Only WDL file is checked if (!file.is_open()) // Only WDL file is checked
return; return;
file.close(); file.close();
foundWDLFiles++;
MaxCardinality = std::max(int(pieces.size()), MaxCardinality); MaxCardinality = std::max(int(pieces.size()), MaxCardinality);
@ -1466,7 +1484,7 @@ void Tablebases::init(const std::string& paths) {
} }
} }
sync_cout << "info string Found " << TBTables.size() << " tablebases" << sync_endl; TBTables.info();
} }
// Probe the WDL table for a particular position. // Probe the WDL table for a particular position.