Skip to content

feat: add browser-playable Gomoku (五子棋) game#1

Open
ThunderDai wants to merge 2 commits intomainfrom
codex/create-web-based-gomoku-game
Open

feat: add browser-playable Gomoku (五子棋) game#1
ThunderDai wants to merge 2 commits intomainfrom
codex/create-web-based-gomoku-game

Conversation

@ThunderDai
Copy link
Copy Markdown
Owner

Motivation

  • 提供一个可直接在浏览器中运行的五子棋(Gomoku)示例页面,方便在静态环境下试玩与集成。

Description

  • 新增 index.html,包含游戏标题、回合状态、重开按钮和用于绘制棋盘的 canvas
  • 新增 styles.css,实现页面与棋盘的基础样式和响应式显示。
  • 新增 script.js,实现棋盘渲染、坐标吸附、落子校验、黑白轮替、四方向连五胜负判定、平局判定和重开功能。
  • 使用 HTML5 Canvas 绘制棋盘与棋子,并在点击事件中处理格位映射与胜负逻辑。

Testing

  • 运行 node --check script.js 校验 JavaScript 语法,结果为成功。
  • 运行 python3 -m py_compile script.js 会失败因为该命令用于 Python 文件而非 JS(该失败为预期误用)。
  • 使用 python3 -m http.server 4173 启动本地静态服务器并用 Playwright 自动化脚本访问 http://127.0.0.1:4173,脚本对画布执行点击并截取页面截图,自动化交互与截图成功。

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant