From 3b797bcee7b2af98ae23e80f95427a667c4379b6 Mon Sep 17 00:00:00 2001 From: CalciteM Date: Sat, 3 Aug 2019 01:48:06 +0800 Subject: [PATCH] =?UTF-8?q?hash:=20=E5=A2=9E=E5=8A=A0=20CLEAR=5FHASH=5FMAP?= =?UTF-8?q?=20=E5=AE=8F=E7=94=A8=E4=BA=8E=E8=B5=B0=E5=AD=90=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E4=B8=8D=E6=B8=85=E7=A9=BA=E5=93=88=E5=B8=8C=E8=A1=A8?= =?UTF-8?q?=20(=E6=9A=82=E4=B8=8D=E5=90=AF=E7=94=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NineChess/src/aithread.cpp | 2 ++ NineChess/src/config.h | 1 + NineChess/src/ninechessai_ab.cpp | 4 ++++ 3 files changed, 7 insertions(+) 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);