2019-11-03 13:00:45 +08:00
|
|
|
|
/*
|
2020-12-14 00:59:45 +08:00
|
|
|
|
This file is part of Sanmill.
|
|
|
|
|
Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
|
2019-11-03 13:00:45 +08:00
|
|
|
|
|
|
|
|
|
Sanmill is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
Sanmill is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2019-09-17 01:58:27 +08:00
|
|
|
|
|
|
|
|
|
#include "endgame.h"
|
|
|
|
|
|
|
|
|
|
#ifdef ENDGAME_LEARNING
|
|
|
|
|
static constexpr int endgameHashsize = 0x1000000; // 16M
|
2020-05-13 01:27:44 +08:00
|
|
|
|
HashMap<key_t, Endgame> endgameHashMap(endgameHashsize);
|
2019-12-22 01:01:51 +08:00
|
|
|
|
|
|
|
|
|
void mergeEndgameFile(QString file1, QString file2, QString mergedFile)
|
|
|
|
|
{
|
2020-05-13 01:27:44 +08:00
|
|
|
|
HashMap<key_t, Endgame> map1(endgameHashsize);
|
|
|
|
|
HashMap<key_t, Endgame> map2(endgameHashsize);
|
2019-12-22 01:01:51 +08:00
|
|
|
|
|
|
|
|
|
map1.load(file1);
|
|
|
|
|
map2.load(file2);
|
|
|
|
|
|
|
|
|
|
map1.merge(map2);
|
|
|
|
|
|
|
|
|
|
map1.dump(mergedFile);
|
|
|
|
|
|
|
|
|
|
loggerDebug("[endgame] Merge %s to %s and save to %s\n",
|
|
|
|
|
file2.toStdString().c_str(),
|
|
|
|
|
file1.toStdString().c_str(),
|
|
|
|
|
mergedFile.toStdString().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int mergeEndgameFile_main()
|
|
|
|
|
{
|
|
|
|
|
QString filename;
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= 12; i++) {
|
|
|
|
|
filename = QString::number(i, 10) + "/endgame.txt";
|
|
|
|
|
mergeEndgameFile("endgame.txt", filename, "endgame.txt");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
system("pause");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-17 01:58:27 +08:00
|
|
|
|
#endif // ENDGAME_LEARNING
|