Merge commit '6135a0e2f830a587d2ac7a332bb62188fa924aad' into cluster

This commit is contained in:
Steinar H. Gunderson
2025-12-25 16:52:43 +01:00
+23 -5
View File
@@ -444,6 +444,8 @@ class TBTables {
std::deque<TBTable<WDL>> wdlTable;
std::deque<TBTable<DTZ>> dtzTable;
size_t foundDTZFiles = 0;
size_t foundWDLFiles = 0;
void insert(Key key, TBTable<WDL>* wdl, TBTable<DTZ>* dtz) {
uint32_t homeBucket = uint32_t(key) & (Size - 1);
@@ -487,9 +489,17 @@ class TBTables {
memset(hashTable, 0, sizeof(hashTable));
wdlTable.clear();
dtzTable.clear();
foundDTZFiles = 0;
foundWDLFiles = 0;
}
size_t size() const { return wdlTable.size(); }
void add(const std::vector<PieceType>& pieces);
void info() const {
if (Distributed::is_root())
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;
@@ -502,13 +512,22 @@ void TBTables::add(const std::vector<PieceType>& pieces) {
for (PieceType pt : pieces)
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
return;
file.close();
foundWDLFiles++;
MaxCardinality = std::max(int(pieces.size()), MaxCardinality);
@@ -1467,8 +1486,7 @@ void Tablebases::init(const std::string& paths) {
}
}
if (Distributed::is_root())
sync_cout << "info string Found " << TBTables.size() << " tablebases" << sync_endl;
TBTables.info();
}
// Probe the WDL table for a particular position.