feat(classic-games): 新增 Mini Focus 小游戏#1239
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2995765c6
ℹ️ 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 (!gameOver && turn === "C") { | ||
| window.setTimeout(playComputerTurn, 350); |
There was a problem hiding this comment.
Cancel pending AI turns on reset
When Reset is clicked during the 350 ms Cyan delay, this timeout still fires against the freshly reset board. Because resetGame() restores turn to "P", the stale playComputerTurn() moves a Cyan stack while Pink is supposed to be choosing and moveStack() credits any overflow to Pink, corrupting the new game state immediately after reset. Store the timer id and clear it on reset, or guard the callback so old turns cannot run after a reset.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260718-0724-focus-lite.htmlValidation
freshBoard、topOf、legalMoves、allMovesFor、scoreOverflow、moveStack、chooseAiMove、playComputerTurn、checkGame、handleCell、renderBoard、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260718-0724-focus-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260718-072733-84071Commit
90b4625f9f2a20a5d1c860cd9fdee1f48cc1f663c2995765c668e1f27cebddaf3ed18be83de0100e