{"id":18697737,"url":"https://github.com/puyuan1996/gomoku_server_ui","last_synced_at":"2026-04-07T09:31:38.426Z","repository":{"id":216121393,"uuid":"740516799","full_name":"puyuan1996/gomoku_server_ui","owner":"puyuan1996","description":"An integrated example of front-end and back-end for a Gomoku game 五子棋前后端集成示例","archived":false,"fork":false,"pushed_at":"2024-01-10T04:02:05.000Z","size":1215,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T03:43:26.224Z","etag":null,"topics":["alpha-beta-pruning","alphazero","backend","flask","frontend","gomoku","mcts","react","reinforcement-learning","rule-based-agent","server","ui"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puyuan1996.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-08T14:02:36.000Z","updated_at":"2024-01-11T15:51:51.000Z","dependencies_parsed_at":"2024-01-17T01:52:14.692Z","dependency_job_id":null,"html_url":"https://github.com/puyuan1996/gomoku_server_ui","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"0647f8a5cbe1d4ac6671e4eac0288681ddd76998"},"previous_names":["puyuan1996/gomoku_server_ui"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/puyuan1996/gomoku_server_ui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puyuan1996%2Fgomoku_server_ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puyuan1996%2Fgomoku_server_ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puyuan1996%2Fgomoku_server_ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puyuan1996%2Fgomoku_server_ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puyuan1996","download_url":"https://codeload.github.com/puyuan1996/gomoku_server_ui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puyuan1996%2Fgomoku_server_ui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31507969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpha-beta-pruning","alphazero","backend","flask","frontend","gomoku","mcts","react","reinforcement-learning","rule-based-agent","server","ui"],"created_at":"2024-11-07T11:25:33.659Z","updated_at":"2026-04-07T09:31:38.413Z","avatar_url":"https://github.com/puyuan1996.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\"\u003e\u003c/div\u003e\n\n# 五子棋前后端集成示例\n\n✨ 这是一个五子棋游戏的前后端集成方案，其中[前端界面](https://github.com/lihongxun945/gobang)基于 React 构建，提供了与用户的交互界面；\n后端服务使用Flask框架搭建，基于 [LightZero](https://github.com/opendilab/LightZero) 实现了五子棋的 AI（包括基于规则的 `RuleBot` 和预训练好的 `AlphaZero` Agent）。\n\n## 快速上手\n\n本指南将帮助您快速部署和启动五子棋游戏的前端和后端服务。\n\n### 前端安装与运行\n\n首先，您需要从GitHub上克隆前端项目代码：\n\n```bash\ngit clone https://github.com/puyuan1996/gomoku_server_ui.git\ncd gomoku/frontend\nnpm install\nnpm run start # 或者 npm run debug 以启动调试模式\n```\n\n上面的命令会安装所有前端依赖，并启动前端开发服务器。\n\n✨注意，与参考的 Gomoku [前端项目](https://github.com/lihongxun945/gobang) 相比，主要更改如下：\n\n- 为了与后端服务器进行交互，增加了与后端交互的代码，主要更改位于：\n  - `src/components/board.js` 的 `handleClick` 函数。\n  - `src/components/control.js` 的 `return` 渲染界面部分。\n  - `src/minimax.worker.js` 的 `start` 和 `move` 函数。\n- 为 React 相关的前端核心文件增加了整体功能和结构概述，以及逐行注释。\n\n### 后端安装与运行\n\n在您的系统中安装好Python环境之后，按照以下步骤配置和运行后端服务：\n\n```bash\ncd gomoku/backend\npip3 install -e .\n# 将miniconda环境路径添加到系统PATH变量中，确保能使用该环境下的Python及其库\nexport PATH=\"/Users/puyuan/miniconda3/envs/arm64-py38/bin:$PATH\"\n# 设置Flask应用的环境变量并启动Flask应用\nFLASK_APP=app.py FLASK_ENV=development FLASK_DEBUG=1 flask run --port 5001\n```\n\n上面的命令将设置必要的环境变量，然后启动Flask服务器。\n\n### 与 AI 对战\n\n✨在前端渲染得到的界面上，一般网址为 http://localhost:3000/。\n您可以选择与不同的 AI 对战，具体界面如下所示：\n\n![ui.png](assets/ui.png)\n\n- [AI 类型] 选择 `AlphaZero` 就是与基于 [LightZero](https://github.com/opendilab/LightZero) 预训练好的 AlphaZero Agent 对战。\n- [AI 类型] 选择 `RuleBot` 就是与 [LightZero](https://github.com/opendilab/LightZero) 中基于规则的 Bot 对战。\n- [AI 类型] 选择 `Random` 就是与随机 Agent 对战。\n- [AI 类型] 选择 `AB-2, AB-4` 表示直接与[前端AI](https://github.com/lihongxun945/gobang) 中的 Alpha-Beta 减枝算法对战，其中 AB-x 中的 x 表示不同的搜索深度，也即不同的水平。\n\n## 致谢\n\n- 🎉在这个五子棋项目中，前端部分是在[lihongxun945/gobang](https://github.com/lihongxun945/gobang)项目上进行了微调，感谢原作者提供的优秀代码作为参考。如果您对五子棋前端AI感兴趣，您可以访问原项目以了解更多详情。\n- 🎉后端 AI 部分基于 [LightZero](https://github.com/opendilab/LightZero) 实现，如果你对 MCTS+RL 算法感兴趣，欢迎访问原项目。\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003e回到顶部\u003c/a\u003e)\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuyuan1996%2Fgomoku_server_ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuyuan1996%2Fgomoku_server_ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuyuan1996%2Fgomoku_server_ui/lists"}