diff --git a/src/ai/evaluate.cpp b/src/ai/evaluate.cpp index 8b82c81c..48fe282c 100644 --- a/src/ai/evaluate.cpp +++ b/src/ai/evaluate.cpp @@ -37,7 +37,7 @@ value_t Evaluation::getValue(Game &tempGame, Position *position, AIAlgorithm::No #endif switch (position->phase) { - case PHASE_NOTSTARTED: + case PHASE_READY: break; case PHASE_PLACING: diff --git a/src/ai/movegen.cpp b/src/ai/movegen.cpp index 3ccbfa71..954bb5c2 100644 --- a/src/ai/movegen.cpp +++ b/src/ai/movegen.cpp @@ -50,7 +50,7 @@ void MoveList::generate(AIAlgorithm &ai, Game &tempGame, newCapacity = 6; } break; - case PHASE_NOTSTARTED: + case PHASE_READY: newCapacity = 24; break; default: @@ -74,7 +74,7 @@ void MoveList::generate(AIAlgorithm &ai, Game &tempGame, case ACTION_CHOOSE: case ACTION_PLACE: // 对于摆子阶段 - if (tempGame.position.phase & (PHASE_PLACING | PHASE_NOTSTARTED)) { + if (tempGame.position.phase & (PHASE_PLACING | PHASE_READY)) { for (move_t i : movePriorityTable) { location = i; @@ -82,7 +82,7 @@ void MoveList::generate(AIAlgorithm &ai, Game &tempGame, continue; } - if (tempGame.position.phase != PHASE_NOTSTARTED || node != root) { + if (tempGame.position.phase != PHASE_READY || node != root) { ai.addNode(node, VALUE_ZERO, (move_t)location, bestMove, tempGame.position.sideToMove); } else { // 若为先手,则抢占星位 diff --git a/src/game/position.cpp b/src/game/position.cpp index 58a5c1fb..06374185 100644 --- a/src/game/position.cpp +++ b/src/game/position.cpp @@ -173,7 +173,7 @@ bool Game::setPosition(const struct Rule *newRule) bool Game::reset() { - if (position.phase == PHASE_NOTSTARTED && + if (position.phase == PHASE_READY && elapsedSeconds[1] == elapsedSeconds[2] == 0) { return true; } @@ -183,7 +183,7 @@ bool Game::reset() moveStep = 0; // 局面阶段标识 - position.phase = PHASE_NOTSTARTED; + position.phase = PHASE_READY; // 设置轮流状态 setSideToMove(PLAYER_1); @@ -262,7 +262,7 @@ bool Game::start() reset(); [[fallthrough]]; // 如果游戏处于未开始状态 - case PHASE_NOTSTARTED: + case PHASE_READY: // 启动计时器 startTime = time(NULL); // 进入开局状态 @@ -280,7 +280,7 @@ bool Game::place(int location, int8_t updateCmdlist) return false; // 如果局面为“未开局”,则开局 - if (position.phase == PHASE_NOTSTARTED) + if (position.phase == PHASE_READY) start(); // 如非“落子”状态,返回false @@ -961,7 +961,7 @@ void Game::setTips() string turnStr = Player::chToStr(position.chSide); switch (position.phase) { - case PHASE_NOTSTARTED: + case PHASE_READY: tips = "轮到玩家1落子,剩余" + std::to_string(position.nPiecesInHand[1]) + "子" + " 比分 " + to_string(score[1]) + ":" + to_string(score[2]) + ", 和棋 " + to_string(score_draw); break; diff --git a/src/game/types.h b/src/game/types.h index ca1494e1..873157cf 100644 --- a/src/game/types.h +++ b/src/game/types.h @@ -95,12 +95,12 @@ enum player_t : uint8_t enum phase_t : uint16_t { PHASE_NONE = 0, - PHASE_NOTSTARTED = 1, // 未开局 + PHASE_READY = 1, // 未开局 PHASE_PLACING = 1 << 1, // 开局(摆棋) PHASE_MOVING = 1 << 2, // 中局(走棋) PHASE_GAMEOVER = 1 << 3, // 结局 PHASE_PLAYING = PHASE_PLACING | PHASE_MOVING, // 进行中 - PHASE_NOTPLAYING = PHASE_NOTSTARTED | PHASE_GAMEOVER, // 不在进行中 + PHASE_NOTPLAYING = PHASE_READY | PHASE_GAMEOVER, // 不在进行中 }; enum value_t : int16_t diff --git a/src/ui/qt/gamecontroller.cpp b/src/ui/qt/gamecontroller.cpp index bf074350..afe85e0f 100644 --- a/src/ui/qt/gamecontroller.cpp +++ b/src/ui/qt/gamecontroller.cpp @@ -669,7 +669,7 @@ bool GameController::actionPiece(QPointF pos) } // 如果未开局则开局 - if (game.getPhase() == PHASE_NOTSTARTED) + if (game.getPhase() == PHASE_READY) gameStart(); // 判断执行选子、落子或去子 @@ -838,7 +838,7 @@ bool GameController::command(const QString &cmd, bool update /* = true */) } // 如果未开局则开局 - if (game.getPhase() == PHASE_NOTSTARTED) { + if (game.getPhase() == PHASE_READY) { gameStart(); }