若为先手则第一着棋抢占星位
This commit is contained in:
parent
d0fc84787c
commit
4b96b675e5
|
@ -252,6 +252,12 @@ public:
|
|||
return currentPos;
|
||||
}
|
||||
|
||||
// 判断位置点是否为星位 (星位是经常会先占的位置)
|
||||
static bool isStartPoint(int pos)
|
||||
{
|
||||
return (pos == 17 || pos == 19 || pos == 21 || pos == 23);
|
||||
}
|
||||
|
||||
// 获取当前步数
|
||||
int getStep() const
|
||||
{
|
||||
|
@ -281,6 +287,7 @@ public:
|
|||
{
|
||||
return winner;
|
||||
}
|
||||
|
||||
// 玩家1和玩家2的用时
|
||||
void getElapsedTimeMS(int &p1_ms, int &p2_ms);
|
||||
|
||||
|
|
|
@ -61,7 +61,14 @@ void NineChessAi_ab::buildChildren(Node *node)
|
|||
if ((chessTemp.context.stage) & (NineChess::GAME_PLACING | NineChess::GAME_NOTSTARTED)) {
|
||||
for (int i = NineChess::POS_BEGIN; i < NineChess::POS_END; i++) {
|
||||
if (!chessTemp.board_[i]) {
|
||||
addNode(node, 0, i);
|
||||
if (node == rootNode && chessTemp.context.stage == NineChess::GAME_NOTSTARTED) {
|
||||
// 若为先手,则抢占星位
|
||||
if (NineChess::isStartPoint(i)) {
|
||||
addNode(node, INT32_MAX, i);
|
||||
}
|
||||
} else {
|
||||
addNode(node, 0, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue