feat(classic-games): 新增 Mini Dao 小游戏#1240
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c4f4abdf4
ℹ️ 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".
| lines.push([[0, 0], [1, 1], [2, 2], [3, 3]]); | ||
| lines.push([[0, 3], [1, 2], [2, 1], [3, 0]]); |
There was a problem hiding this comment.
Remove diagonal lines from the win check
On the shipped starting board, Green occupies the main diagonal and Violet occupies the anti-diagonal. These two entries therefore make both sides already satisfy hasLine(); after any legal first Green move, Green's diagonal is broken while Violet's remains, so checkWinner() declares "Violet wins" before the AI takes a turn. Dao's four-in-a-row win is horizontal/vertical rather than diagonal (GamesCrafters), so these diagonals need to be excluded or the initial layout changed.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260718-0754-dao-lite.htmlValidation
freshBoard、slideTarget、legalMoves、allMovesFor、hasLine、hasSquare、hasCorners、checkWinner、movePiece、chooseAiMove、playComputerTurn、handleCell、renderBoard、render、addEventListenernew Function(...)git diff --check -- project/classic-games/20260718-0754-dao-lite.htmlAudit
run-audit.shOVERALL_EXIT=0/tmp/git-commit-audit-20260718-075850-85766Commit
b53c42c99ad15eda12e93b78aec8132c9eaf390f8c4f4abdf42e73edd57c5b15f2ef0753e072a8b0