
Purpose of this post
This post publishes the source code used in the Gomoku AI experiments. The code is loaded only when you open a file.
Models used
- VLM: 25,413 game moves were played with Qwen3-VL-8B-Instruct from Hugging Face. The server currently runs the default, Qwen3-VL-2B-Instruct. It receives a board image and a text board together and returns two numbers, "row col".
- LoRA: peft, r=8, alpha=16. It trains only on the winning side's moves. On MPS it ran in fp16 and the loss became NaN.
- Local AI: the C++ AiPlayer in the Qt app and ai.ts on the web. A heuristic that first looks for winning moves and moves that must be blocked, and otherwise picks by adding up scores in four directions.
- Engine: the same forbidden moves for Black and White (double-three and overline forbidden, double-four allowed); only exactly five wins.
Folder layout
- src: Qt6/C++ Gomoku engine, local AI, board screen, TCP client that talks to the VLM server
- .py files at the root: VLM inference server (vlm_pva_server.py), dataset_omook.py that turns logs into training data, LoRA training train_vlm.py, model download
- scripts: VLM coordinate checks and a text board client
- omook-web: Next.js web game screen, engine (board.ts), local AI (ai.ts), game record storage (db.ts), VLM connection
Server deployment settings, monitoring and automation scripts, game logs and the game record DB, and model weights are excluded from the release. Web operation code such as ads and the list of other games, and configuration files are also left out, so some imports point to unpublished files.
Full source
38 files · 8,212 lines — open a folder and click a file to load its code.
Project root
CMakeLists.txt
Loading code…
dataset_omook.py
Loading code…
download_qwen3vl.py
Loading code…
requirements.txt
Loading code…
train_vlm.py
Loading code…
TRAINING.md
Loading code…
vlm_pva_server.py
Loading code…
omook-web/
omook-web/app/api/game/[code]/route.ts
Loading code…
omook-web/app/api/game/route.ts
Loading code…
omook-web/app/api/vlm/move/route.ts
Loading code…
omook-web/app/globals.css
Loading code…
omook-web/app/layout.tsx
Loading code…
omook-web/app/page.tsx
Loading code…
omook-web/app/play/page.tsx
Loading code…
omook-web/app/play/play.module.css
Loading code…
omook-web/components/OmokBoard.module.css
Loading code…
omook-web/components/OmokBoard.tsx
Loading code…
omook-web/lib/ai.ts
Loading code…
omook-web/lib/board.ts
Loading code…
omook-web/lib/db.ts
Loading code…
omook-web/lib/gameTypes.ts
Loading code…
omook-web/lib/guest.ts
Loading code…
omook-web/lib/omk3Client.ts
Loading code…
omook-web/lib/renderBoardPng.ts
Loading code…
omook-web/lib/vlmClient.ts
Loading code…
scripts/
scripts/probe_vlm_coords.py
Loading code…
scripts/vlm_text_client.py
Loading code…
src/
src/aiplayer.cpp
Loading code…
src/aiplayer.h
Loading code…
src/boardmodel.cpp
Loading code…
src/boardmodel.h
Loading code…
src/boardwidget.cpp
Loading code…
src/boardwidget.h
Loading code…
src/main.cpp
Loading code…
src/mainwindow.cpp
Loading code…
src/mainwindow.h
Loading code…
src/tcpvlmclient.cpp
Loading code…
src/tcpvlmclient.h
Loading code…
COMMENTS · CHAPTER 05
The full source code and the models used 0 comments
No comments yet. Leave a question or anything you would like to add.
To post a comment, continue with Google and register a nickname and email address.
Continue with Google