feat(classic-games): 新增 Mini Obstruction 小游戏#1223
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: dcad6e5f80
ℹ️ 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".
| window.setTimeout(() => { | ||
| const aiIndex = chooseAiMove(); | ||
| if (aiIndex !== undefined) applyMove(aiIndex, "A"); |
There was a problem hiding this comment.
Cancel pending AI turns when restarting
When the player clicks New Game during this 260 ms AI delay, the scheduled callback still runs against the freshly reset board because startGame() does not clear or invalidate the timeout. This makes the new game unexpectedly receive an AI move and blocked neighbors immediately after restart, so the reset state is corrupted unless the user waits for the old AI turn to finish.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260717-2324-obstruction-lite.htmlValidation
startGame、neighborsOf、availableCells、applyMove、scoreCell、chooseAiMove、chooseCell、checkGame、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260717-2324-obstruction-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260717-232855-49802Commit
a5566978511d913fa934718a32de6592b9dfe427dcad6e5f80706ffe22ed581891c1930bdf461e2e