refactor: 置换表数据结构转移到 tt 模块

This commit is contained in:
CalciteM 2019-09-09 00:56:46 +08:00
parent 6360e1ff20
commit 7236e32986
5 changed files with 20 additions and 8 deletions

View File

@ -24,6 +24,7 @@ INCLUDEPATH += src/ui/qt
SOURCES += \
src/ai/evaluate.cpp \
src/ai/movegen.cpp \
src/ai/tt.cpp \
src/game/board.cpp \
src/game/millgame.cpp \
src/game/rule.cpp \
@ -45,6 +46,7 @@ HEADERS += \
include/version.h.template \
src/ai/evaluate.h \
src/ai/movegen.h \
src/ai/tt.h \
src/base/HashNode.h \
src/base/debug.h \
src/base/hashMap.h \

View File

@ -28,15 +28,11 @@
#include "evaluate.h"
#include "movegen.h"
#include "hashmap.h"
#include "tt.h"
#include "types.h"
using namespace CTSL;
#ifdef TRANSPOSITION_TABLE_ENABLE
static constexpr int TRANSPOSITION_TABLE_SIZE = 0x2000000; // 8-128M:102s, 4-64M:93s 2-32M:91s 1-16M: 冲突
HashMap<hash_t, MillGameAi_ab::HashValue> transpositionTable(TRANSPOSITION_TABLE_SIZE);
#endif // TRANSPOSITION_TABLE_ENABLE
#ifdef BOOK_LEARNING
static constexpr int bookHashsize = 0x1000000; // 16M
HashMap<hash_t, MillGameAi_ab::HashValue> bookHashMap(bookHashsize);

View File

@ -260,9 +260,7 @@ private:
char cmdline[64] {};
};
#ifdef TRANSPOSITION_TABLE_ENABLE
extern HashMap<hash_t, MillGameAi_ab::HashValue> transpositionTable;
#endif /* TRANSPOSITION_TABLE_ENABLE */
#include "tt.h"
#ifdef THREEFOLD_REPETITION
extern vector<hash_t> positions;

View File

@ -1,2 +1,6 @@
#include "tt.h"
#ifdef TRANSPOSITION_TABLE_ENABLE
static constexpr int TRANSPOSITION_TABLE_SIZE = 0x2000000; // 8-128M:102s, 4-64M:93s 2-32M:91s 1-16M: 冲突
HashMap<hash_t, MillGameAi_ab::HashValue> transpositionTable(TRANSPOSITION_TABLE_SIZE);
#endif // TRANSPOSITION_TABLE_ENABLE

View File

@ -1,5 +1,17 @@
#ifndef TT_H
#define TT_H
#include "config.h"
#include "types.h"
#include "millgame.h"
#include "search.h"
#include "hashmap.h"
using namespace CTSL;
#ifdef TRANSPOSITION_TABLE_ENABLE
extern HashMap<hash_t, MillGameAi_ab::HashValue> transpositionTable;
#endif /* TRANSPOSITION_TABLE_ENABLE */
#endif /* TT_H */