Choose a random side against the computer

未关闭 适合新手
#163 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript
领域
frontend, game-dev

调研方向

阅读 index.html 中的 #side-select 和 js/main.js 第 190–197 行附近的代码,追踪所选方如何保存以及棋盘如何翻转。然后检查 js/game.js 和 tests/unit/settings.test.js,了解新游戏和已保存游戏状态的工作方式。添加 Random 选项,使每局新游戏都选择一方,同时重新加载时保留该局的所选方;使用桩替换的 Math.random 运行 npm ci && npm test 进行验证。

由索引模型根据 Issue 内容生成。

描述

enhancement good first issue severity: low

Summary

Against the computer the player chooses White or Black; there is no Random option.

Where

  • index.html:159-161 (#side-select)
  • js/main.js:190-197 (the choice is stored and also flips the board)

Proposal

Add a "Random" option. Store random as the setting, and pick White or Black at each New Game, flipping the board to match. The chosen side is recorded in the game as today, so reload and PGN stay correct.

Who benefits

Players who want variety without choosing each time; a common option in chess apps.

Acceptance criteria

  • With Random selected, New Game picks a side and the board orientation matches
  • Reloading keeps the side of the game in progress (it does not re-roll)
  • Tests with a stubbed Math.random

Getting started

  • Relevant files: index.html, js/main.js, js/game.js, tests/unit/settings.test.js
  • How to run tests: npm ci && npm test

Filed by repo-audit/full-audit at 73cd279. Severity: low. Effort: S. audit-key: enhancement|index.html|side-select

主要语言
JavaScript
星标
4
派生
2
平均合并
6 小时 13 分钟
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/Static_Chess 的其他 Issue

查看 TMHSDigital/Static_Chess 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。