feat(classic-games): 新增 Mini Rota 小游戏#1218
Conversation
Made-with: Cursor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86a4880cbb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| function playComputerTurn() { | ||
| if (gameOver) return; |
There was a problem hiding this comment.
Guard stale AI timeouts after reset
If the player clicks 重开 during the 400 ms AI thinking delay after a human move, startGame() resets turn to "H" but the pending timeout still calls this function; because it only checks gameOver, the AI immediately places a piece on the freshly reset board before the player moves. Cancel the pending timeout on reset or return here unless turn === "A" so old callbacks cannot mutate a new game.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260717-2053-rota-lite.htmlValidation
startGame、neighbors、winner、legalMoves、applyMove、scoreMove、playComputerTurn、chooseCell、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260717-2053-rota-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260717-205658-29723Commit
887c37ba46d65caf263b2e7fa9e32221471293be86a4880cbb9d1a0cfaf391e7cd69974d5d472a76