feat(classic-games): 新增 Mini Score Four 小游戏#1222
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: 98a21168fe
ℹ️ 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 (player === "H") { | ||
| locked = true; | ||
| setMessage("AI 思考中..."); | ||
| setTimeout(playComputerTurn, 450); |
There was a problem hiding this comment.
Cancel pending AI turns when restarting
When the player clicks 重开 during the 450 ms “AI 思考中...” delay, this timeout is not cleared or tied to a game generation. startGame() resets gameOver to false, so the old playComputerTurn still runs against the newly reset board and can place an AI piece before the player has moved, or interleave with a new game. Store the timeout id and clear it on reset, or ignore callbacks from stale games.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260717-2254-score-four-lite.htmlValidation
startGame、buildLines、topIndex、legalMoves、winner、scoreMove、chooseAiMove、placePiece、chooseColumn、playComputerTurn、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260717-2254-score-four-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260717-225724-45727Commit
fa3646978636d233caa19c5d55dfe26036d4174898a21168feee795df804b4cb356d2e09455282f7