refactor: 让 NODE_CHILDREN_SIZE 直接等于 MOVE_COUNT
顺带加了一段 MCTS 相关的双方棋盘上棋子数相差4则算负的代码但未启用。
This commit is contained in:
parent
1748dbef70
commit
1e6456b902
|
@ -92,7 +92,7 @@ public:
|
|||
string indentString(int indent) const;
|
||||
#endif // MCTS_AI
|
||||
|
||||
static const int NODE_CHILDREN_SIZE = (4 * 4 + 3 * 4 * 2); // TODO: 缩减空间
|
||||
static const int NODE_CHILDREN_SIZE = MOVE_COUNT;
|
||||
|
||||
Node *children[NODE_CHILDREN_SIZE];
|
||||
Node *parent { nullptr };
|
||||
|
|
|
@ -923,6 +923,29 @@ bool Game::checkGameOverCondition()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MCTS_AI
|
||||
#if 0
|
||||
int diff = position->nPiecesOnBoard[BLACK] - position->nPiecesOnBoard[WHITE];
|
||||
if (diff > 4) {
|
||||
winner = PLAYER_BLACK;
|
||||
position->phase = PHASE_GAMEOVER;
|
||||
sprintf(cmdline, "Player1 win!");
|
||||
cmdlist.emplace_back(string(cmdline));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (diff < -4) {
|
||||
winner = PLAYER_WHITE;
|
||||
position->phase = PHASE_GAMEOVER;
|
||||
sprintf(cmdline, "Player2 win!");
|
||||
cmdlist.emplace_back(string(cmdline));
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// 如果摆满了,根据规则判断胜负
|
||||
if (position->nPiecesOnBoard[BLACK] + position->nPiecesOnBoard[WHITE] >= Board::N_SEATS * Board::N_RINGS) {
|
||||
position->phase = PHASE_GAMEOVER;
|
||||
|
|
Loading…
Reference in New Issue