search: 将搜索到决胜局面与搜索第0层或需要退出合在一起处理

This commit is contained in:
Calcitem 2019-12-05 00:39:59 +08:00
parent 4c007940c9
commit 578070d8f4
1 changed files with 6 additions and 20 deletions

View File

@ -753,8 +753,10 @@ value_t AIAlgorithm::search(depth_t depth, value_t alpha, value_t beta, Node *no
#endif // TRANSPOSITION_TABLE_ENABLE
#endif // DEBUG_AB_TREE
// 搜索到叶子节点(决胜局面) // TODO: 对哈希进行特殊处理
if (unlikely(position->phase == PHASE_GAMEOVER)) {
if (unlikely(position->phase == PHASE_GAMEOVER) || // 搜索到叶子节点(决胜局面) // TODO: 对哈希进行特殊处理
!depth || // 搜索到第0层
unlikely(requiredQuit)) {
// 局面评估
node->value = Evaluation::getValue(tempGame, position, node);
evaluatedNodeCount++;
@ -766,27 +768,11 @@ value_t AIAlgorithm::search(depth_t depth, value_t alpha, value_t beta, Node *no
node->value -= depth;
}
#ifdef DEBUG_AB_TREE
node->isLeaf = true;
#endif
#ifdef TRANSPOSITION_TABLE_ENABLE
// 记录确切的哈希值
TT::recordHash(node->value, depth, TT::hashfEXACT, hash, MOVE_NONE);
#endif
return node->value;
}
// 搜索到第0层或需要退出
if (!depth || unlikely(requiredQuit)) {
// 局面评估
node->value = Evaluation::getValue(tempGame, position, node);
evaluatedNodeCount++;
#ifdef DEBUG_AB_TREE
if (requiredQuit) {
node->isTimeout = true;
} else {
node->isLeaf = true;
}
#endif