feat(classic-games): 新增 Mini Sylver Coinage 小游戏#1234
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: a9675ed001
ℹ️ 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".
| } | ||
| render(); | ||
| if (!finished && !playerTurn) { | ||
| window.setTimeout(computerMove, 450); |
There was a problem hiding this comment.
Cancel queued computer moves when resetting
When the player clicks Reset during the 450 ms computer delay, this queued callback still runs against the freshly reset state because the timeout is not stored or cleared. Since playNumber does not verify that it is actually the computer's turn, the stale callback injects a computer-selected number into the new game, initially treating it as the player's move and potentially scheduling another computer move. Store and clear the timeout on reset, or guard the callback with a game/version token.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260718-0454-sylver-coinage-lite.htmlValidation
resetGame、canMake、isLegal、legalNumbers、playNumber、computerMove、submitMove、renderPills、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260718-0454-sylver-coinage-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260718-045702-74934Commit
fbc62aafaeb5d26349f3278bfab8aac80b2231ffa9675ed0010a6b5e6ebab46f72de06d9a8f0b812