
本文的目的
公开黑白棋 AI 使用的源代码。只有在展开文件时才会加载代码。
使用的模型
- Gemma 4 E4B(mlx-community/gemma-4-e4b-it-4bit):VLM 服务器的默认模型。目前因加载失败而没有被使用。
- mlx-vlm:在 Apple Silicon 上运行模型。
- 本地 AI:不是训练出来的模型。源代码中是 alpha-beta 搜索,已部署的网页上是只看一步的加权 AI。
- 目前还没有训练好的模型。
文件夹结构
- src:Qt6 C++ 应用。规则引擎(othello_board)、搜索 AI(aiplayer)、VLM 客户端(tcpvlmclient)
- vlm_server:OT88 TCP 服务器、规则、Gemma 4 下载
- othello-web:Next.js 网页对局。规则引擎(board.ts)、搜索 AI(ai.ts)、对局保存(db.ts)、VLM 中转(api/vlm/move、ot88Client.ts)
服务器部署配置、监控与自动化脚本、对局数据和日志不在公开范围内。广告、其他游戏列表等网页运营代码以及配置文件也已去掉,因此部分 import 指向的是未公开的文件。
完整源代码
37 个文件 · 5,381 行 — 展开文件夹后点击文件即可加载代码。
项目根目录
CMakeLists.txt
正在加载代码…
othello-web/
othello-web/app/api/game/[code]/route.ts
正在加载代码…
othello-web/app/api/game/route.ts
正在加载代码…
othello-web/app/api/vlm/move/route.ts
正在加载代码…
othello-web/app/globals.css
正在加载代码…
othello-web/app/layout.tsx
正在加载代码…
othello-web/app/page.tsx
正在加载代码…
othello-web/app/play/page.tsx
正在加载代码…
othello-web/app/play/play.module.css
正在加载代码…
othello-web/components/OthelloBoard.module.css
正在加载代码…
othello-web/components/OthelloBoard.tsx
正在加载代码…
othello-web/lib/ai.ts
正在加载代码…
othello-web/lib/board.ts
正在加载代码…
othello-web/lib/db.ts
正在加载代码…
othello-web/lib/gameTypes.ts
正在加载代码…
othello-web/lib/guest.ts
正在加载代码…
othello-web/lib/ot88Client.ts
正在加载代码…
othello-web/lib/renderBoardPng.ts
正在加载代码…
othello-web/lib/vlmClient.ts
正在加载代码…
othello-web/package.json
正在加载代码…
src/
src/aiplayer.cpp
正在加载代码…
src/aiplayer.h
正在加载代码…
src/boardwidget.cpp
正在加载代码…
src/boardwidget.h
正在加载代码…
src/main.cpp
正在加载代码…
src/mainwindow.cpp
正在加载代码…
src/mainwindow.h
正在加载代码…
src/othello_board.cpp
正在加载代码…
src/othello_board.h
正在加载代码…
src/tcpvlmclient.cpp
正在加载代码…
src/tcpvlmclient.h
正在加载代码…
vlm_server/
vlm_server/__init__.py
正在加载代码…
vlm_server/__main__.py
正在加载代码…
vlm_server/download_gemma4.py
正在加载代码…
vlm_server/othello_rules.py
正在加载代码…
vlm_server/requirements.txt
正在加载代码…
vlm_server/server.py
正在加载代码…
COMMENTS · CHAPTER 05
完整源代码与使用的模型 评论 0
还没有评论。阅读时有疑问或想补充的内容,欢迎留言。
发表评论前,请用 Google 开始并登记昵称和邮箱。
用 Google 开始