diff --git a/NineChess/src/ninechessai_ab.cpp b/NineChess/src/ninechessai_ab.cpp index da9c7c3b..65943f96 100644 --- a/NineChess/src/ninechessai_ab.cpp +++ b/NineChess/src/ninechessai_ab.cpp @@ -509,6 +509,9 @@ int NineChessAi_ab::alphaBetaPruning(int depth, int alpha, int beta, Node *node) // 临时增加的深度,克服水平线效应用 int epsilon = 0; + // 哈希类型 + enum HashType hashf = hashfALPHA; + #ifdef DEBUG_AB_TREE node->depth = depth; node->root = rootNode; @@ -682,7 +685,7 @@ int NineChessAi_ab::alphaBetaPruning(int depth, int alpha, int beta, Node *node) #ifdef HASH_MAP_ENABLE if (iter == hashmap.end()) { // 添加到hashmap - recordHash(hash, depth, node->value, hashfEMPTY); + recordHash(hash, depth, node->value, hashf); } // 更新更深层数据 else { @@ -708,8 +711,11 @@ int NineChessAi_ab::recordHash(uint64_t hash, int16_t depth, int value, enum Has hashMapMutex.lock(); HashValue hashValue; + hashValue.value = value; hashValue.depth = depth; + hashValue.type = type; + if (hashmap.size() <= maxHashCount) hashmap.insert({ hash, hashValue }); diff --git a/NineChess/src/ninechessai_ab.h b/NineChess/src/ninechessai_ab.h index 335216bb..7fa1d6b5 100644 --- a/NineChess/src/ninechessai_ab.h +++ b/NineChess/src/ninechessai_ab.h @@ -40,7 +40,7 @@ public: { int16_t value; int16_t depth; - enum hashType type; + enum HashType type; }; // 定义一个节点结构体