ShashChess 16 does not produce al learning file (Persisted learning = Standard) on Mac M1.
The file is produced during running eng matches, but after the match it is deleted.
There must be something wrong in tt.cpp.
Code: Select all
void writeLearningFile()
{
/*
To avoid any problems when saving to experience file, we will actually do the following:
1) Save new experience to "experience_new.bin"
2) Remove "experience.bin"
3) Rename "experience_new.bin" to "experience.bin"
This approach is failproof so that the old file is only removed when the new file is sufccessfully saved!
If, for whatever odd reason, the engine is able to execute step (1) and (2) and fails to execute step (3)
i.e., we end up with experience0.bin then it is not a problem since the file will be loaded anyway the next
time the engine starts!
*/
if (!globalLearningHT.empty())
{
std::ofstream outputFile(Utility::map_path("experience_new.bin"), std::ofstream::trunc | std::ofstream::binary);
for (auto& it : globalLearningHT)
{
LearningFileEntry currentFileExpEntry;
NodeInfo currentNodeInfo = it.second;
int siblingMoveInfoSize = currentNodeInfo.siblingMoveInfo.size();
for (int k = 0; k < siblingMoveInfoSize; k++)
{
MoveInfo currentLatestMoveInfo = currentNodeInfo.siblingMoveInfo[k];
currentFileExpEntry.depth = currentLatestMoveInfo.depth;
currentFileExpEntry.hashKey = it.first;
currentFileExpEntry.move = currentLatestMoveInfo.move;
currentFileExpEntry.score = currentLatestMoveInfo.score;
currentFileExpEntry.performance = currentLatestMoveInfo.performance;
outputFile.write((char*)¤tFileExpEntry, sizeof(currentFileExpEntry));
}
}
outputFile.close();
remove(Utility::map_path("experience.bin").c_str());
rename(Utility::map_path("experience_new.bin").c_str(), Utility::map_path("experience.bin").c_str());
}
}