feat(classic-games): 新增 Mini Martian Chess 小游戏#1238
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44749a6e26
ℹ️ 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".
| checkGame(); | ||
| render(); | ||
| if (!gameOver && turn === "O") { | ||
| window.setTimeout(playComputerTurn, 400); |
There was a problem hiding this comment.
Cancel pending AI turns on reset
If the player clicks Reset during the 400 ms AI delay, this timeout is still live and playComputerTurn runs against the freshly reset board. Because resetGame() restores turn to "G", the stale AI move is applied while the game believes it is Green's turn, which can award captures to the wrong side, toggle the new game back to Orange, and schedule another AI turn before the player can act. Store the timeout id and clear or invalidate it when resetting.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260718-0654-martian-chess-lite.htmlValidation
freshBoard、ownerOf、pathClear、canMovePiece、legalMoves、allMovesFor、movePiece、chooseAiMove、playComputerTurn、checkGame、handleCell、renderBoard、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260718-0654-martian-chess-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260718-070017-82418Commit
acf4b62940662773bab5fb41a8bfe6a50e354ea644749a6e263fdd1511d2edbf4945fecc9f78c5da