diff --git a/NineChess/src/aithread.cpp b/NineChess/src/aithread.cpp index d9bb765d..cf0820f8 100644 --- a/NineChess/src/aithread.cpp +++ b/NineChess/src/aithread.cpp @@ -70,7 +70,9 @@ void AiThread::setAi(const NineChess &chess) #ifdef HASH_MAP_ENABLE // 新下一盘前清除哈希表 (注意可能同时存在每步之前清除) +#ifdef CLEAR_HASH_MAP ai_ab.clearHashMap(); +#endif #endif mutex.unlock(); diff --git a/NineChess/src/config.h b/NineChess/src/config.h index 4ee277a5..4add01bf 100644 --- a/NineChess/src/config.h +++ b/NineChess/src/config.h @@ -30,6 +30,7 @@ #define IDS_SUPPORT #define HASH_MAP_ENABLE +//#define CLEAR_HASH_MAP #define MEMORY_POOL diff --git a/NineChess/src/ninechessai_ab.cpp b/NineChess/src/ninechessai_ab.cpp index 4c030c57..4816b856 100644 --- a/NineChess/src/ninechessai_ab.cpp +++ b/NineChess/src/ninechessai_ab.cpp @@ -669,7 +669,9 @@ int NineChessAi_ab::alphaBetaPruning(int depth) // 深化迭代 for (int i = 2; i < d; i += 2) { #ifdef HASH_MAP_ENABLE +#ifdef CLEAR_HASH_MAP clearHashMap(); // 每次走子前清空哈希表 +#endif #endif alphaBetaPruning(i, -INF_VALUE, INF_VALUE, rootNode); } @@ -678,7 +680,9 @@ int NineChessAi_ab::alphaBetaPruning(int depth) #endif /* IDS_SUPPORT */ #ifdef HASH_MAP_ENABLE +#ifdef CLEAR_HASH_MAP clearHashMap(); // 每次走子前清空哈希表 +#endif #endif value = alphaBetaPruning(d, -INF_VALUE /* alpha */, INF_VALUE /* beta */, rootNode);