diff --git a/src/ai/search.h b/src/ai/search.h index 35357fa7..0684c676 100644 --- a/src/ai/search.h +++ b/src/ai/search.h @@ -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 }; diff --git a/src/game/position.cpp b/src/game/position.cpp index ab33c6bd..1d4440f6 100644 --- a/src/game/position.cpp +++ b/src/game/position.cpp @@ -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;