feat(classic-games): 新增 Mini Cram 小游戏#1220
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: 657fd6ddf3
ℹ️ 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".
| if (checkGame("A")) return; | ||
| locked = true; | ||
| setMessage("AI 思考中..."); | ||
| setTimeout(playComputerTurn, 450); |
There was a problem hiding this comment.
Cancel pending AI turns when restarting
When the player hits “重开” during the 450 ms AI delay, this timeout is still queued while startGame() resets gameOver and the board, so the old playComputerTurn runs against the fresh game and immediately places an AI domino before the player moves. Store/clear the timer on reset or guard it with a turn/game token so restarting always leaves an empty board.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260717-2154-cram-lite.htmlValidation
startGame、legalMoves、mobilityAfter、chooseAiMove、placeDomino、checkGame、chooseCell、playComputerTurn、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260717-2154-cram-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260717-215710-38207Commit
84b8de77293c677619967c04ec21947075d629f7657fd6ddf3fcdb7c24f3b9e44d07a14ef59da96f