hash: 增加 CLEAR_HASH_MAP 宏用于走子之前不清空哈希表 (暂不启用)

This commit is contained in:
CalciteM 2019-08-03 01:48:06 +08:00 committed by CalciteM Team
parent 1e3365ec03
commit 3b797bcee7
3 changed files with 7 additions and 0 deletions

View File

@ -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();

View File

@ -30,6 +30,7 @@
#define IDS_SUPPORT
#define HASH_MAP_ENABLE
//#define CLEAR_HASH_MAP
#define MEMORY_POOL

View File

@ -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);