HASH: 把最优着法插入首位而非和首位交换

This commit is contained in:
CalciteM Team 2019-07-20 09:59:24 +08:00
parent 081342bd89
commit a6a1923163
1 changed files with 10 additions and 5 deletions

View File

@ -102,13 +102,18 @@ struct NineChessAi_ab::Node *NineChessAi_ab::addNode(Node *parent, int value, in
#endif // DEBUG_AB_TREE
if (parent) {
parent->children.push_back(newNode); // (7%)
if (bestMove != 0 && move == bestMove) {
// 把哈希得到的最优着法换到首位
parent->children.insert(parent->children.begin(), newNode);
} else {
parent->children.push_back(newNode); // (7%)
}
}
// 把哈希得到的最优着法换到首位
if (bestMove != 0 && move == bestMove) {
std::swap(parent->children[0], parent->children[parent->children.size() - 1]);
}
// if (bestMove != 0 && move == bestMove) {
// std::swap(parent->children[0], parent->children[parent->children.size() - 1]);
// }
return newNode;
}