Make the AI opponent skeleton playable (single-player mode)
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript
- 领域
- game-dev
调研方向
Start with js/ai.js and js/game.js, especially the listed move generation and search methods, then read docs/ARCHITECTURE.md. The proposal spans legal move generation, search, UI controls, and responsive play, with a Web Worker question still open. Done means a player can choose a side, start a game against the computer, and the computer always makes legal moves while the UI stays responsive.
由索引模型根据 Issue 内容生成。
描述
Summary
The app supports only two players on one device. js/ai.js holds an AI skeleton, but it is not loaded and cannot produce a move.
Where
js/ai.js:132-139(_getAllLegalMovesreturns[]),js/ai.js:76-86(findBestMovetherefore resolvesnull),js/ai.js:151-161(_minimaxreturns 0)js/config.js:13,js/config.js:26(AI_DIFFICULTY: 'easy'does not match theEASY/MEDIUM/HARDkeys atjs/ai.js:9-13)index.html:65-71(script not loaded),js/game.js:313-325(generateAllLegalMoves)
Proposal
- Make move generation and apply/unapply take a board argument so search can run on a copy (#31).
- Ship a first version that plays a random legal move, then a material-greedy one-ply move using the existing
_evaluatePosition. - Add minimax with alpha-beta at depth 2 to 3.
- UI: a "Play vs computer" toggle with side and difficulty selectors; lock input while the AI is thinking; Undo takes back two plies in AI mode. Normalise the difficulty key casing.
Open question: depth 4 on the main thread may stall the UI. A Web Worker needs the engine code to be DOM-free, which game.js is not today.
Who benefits
Solo visitors to the hosted page, who currently have no one to play against.
Acceptance criteria
- A player can start a game against the computer and pick a side
- The computer always plays a legal move
- The UI stays responsive while it thinks
Getting started
- Relevant files:
js/ai.js,js/game.js,js/config.js,index.html - How to run tests:
npm install, thennpm testandnpm run lint - Related docs:
docs/ARCHITECTURE.md,.github/CONTRIBUTING.md
Filed by repo-audit/full-audit at 8a2c86c. Severity: medium. Effort: L. audit-key: enhancement|js/ai.js|ChessAI._getAllLegalMoves
- 主要语言
- JavaScript
- 星标
- 4
- 派生
- 2
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TMHSDigital/Static_Chess 的其他 Issue
-
enhancement good first issue severity: medium
难度 2/5 1-3 小时 新手友好度 78/100
TMHSDigital/Static_Chess#53 ·
-
documentation good first issue severity: low
难度 2/5 1-3 小时 新手友好度 72/100
TMHSDigital/Static_Chess#49 ·
-
documentation good first issue severity: low
难度 2/5 1-3 小时 新手友好度 83/100
TMHSDigital/Static_Chess#48 ·
-
documentation severity: medium
难度 2/5 1-3 小时 新手友好度 78/100
TMHSDigital/Static_Chess#47 ·
-
documentation good first issue severity: low
难度 2/5 1-3 小时 新手友好度 82/100
TMHSDigital/Static_Chess#46 ·
查看 TMHSDigital/Static_Chess 的全部 Issue
相似的 Issue
-
good first issue tests
难度 1/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 90/100
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
难度 2/5 1-3 小时 新手友好度 65/100
growilabs/growi#12246 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
TMHSDigital/Free-Game-Dev-Assets#301 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100