剩余的 Data 改名为 Context

This commit is contained in:
CalciteM 2019-06-30 15:39:25 +08:00
parent ed5cf81712
commit c80759fe1e
2 changed files with 5 additions and 5 deletions

View File

@ -528,7 +528,7 @@ int NineChessAi_ab::alphaBetaPruning(int depth, int alpha, int beta, Node *node)
if (iter != hashmap.end()) {
if (iter->second.depth >= depth) {
node->value = iter->second.value;
if (chessData->turn == NineChess::PLAYER1)
if (chessContext->turn == NineChess::PLAYER1)
node->value += iter->second.depth - depth;
else
node->value -= iter->second.depth - depth;
@ -551,11 +551,11 @@ int NineChessAi_ab::alphaBetaPruning(int depth, int alpha, int beta, Node *node)
minMax = chessTemp.whosTurn() == NineChess::PLAYER1 ? -INF_VALUE : INF_VALUE;
for (auto child : node->children) {
dataStack.push(chessTemp.context);
contextStack.push(chessTemp.context);
chessTemp.command(child->move);
value = alphaBetaPruning(depth - 1, alpha, beta, child);
chessTemp.context = dataStack.top();
dataStack.pop();
chessTemp.context = contextStack.top();
contextStack.pop();
if (chessTemp.whosTurn() == NineChess::PLAYER1) {
// 取最大值

View File

@ -129,7 +129,7 @@ private:
size_t evaluatedNodeCount;
// 局面数据栈
stack<NineChess::ChessContext> dataStack;
stack<NineChess::ChessContext> contextStack;
// 标识,用于跳出剪枝算法,立即返回
bool requiredQuit;