A Go engine with Chinese rules, MCTS search, GTP, and self-play — inspired by Wu et al. 2020. Not KataGo.
See CHANGELOG.md for release notes.
make build # -> bin/gofer
make test
make bench-check # same regression gate as CIbin/gofer -play -size 9 -color b
# commands: play D4 | genmove | analyze | board | score | undo | quit
# save game on quit: bin/gofer -play -o game.sgfbin/gofer -analyze -size 9 -playouts 400
bin/gofer -analyze -size 9 -think-time 3s -top 8
bin/gofer -analyze -size 9 -moves D4,Q16,passEngine command:
bin/gofer -gtp -size 9 -think-time 5s -eval heuristic
Save game on quit:
bin/gofer -gtp -size 9 -o game.sgf
Or fixed playouts:
bin/gofer -gtp -gtp-playouts 800 -eval heuristic
Sabaki demo (9×9, think-time, SGF on quit):
- Build:
make build - Sabaki → Engines → Manage engines → Add
- Command:
bin/gofer -gtp -size 9 -think-time 5s -eval heuristic -o demo.sgf - New game 9×9, play; on quit the engine writes
demo.sgf
Plot arena gating curve: ./scripts/plot-gating.sh .tectonix/reports/arena-9x9-baseline.json
Nightly 200-game arena workflow: .github/workflows/arena-nightly.yml (also make reproduce-9x9-baseline).
bin/gofer -watch -size 9 -playouts 50Default path is in-process ORT (no sidecar). Build with ONNX support:
make build-onnx # CGO + -tags=onnx -> bin/goferUse -eval-backend to choose the transport:
| Flag / env | Values | Default |
|---|---|---|
-eval-backend |
inprocess, sidecar |
inprocess |
EVAL_BACKEND |
same (train loop) | inprocess |
-model |
champion ONNX path | models/gofer-9x9-bootstrap.onnx |
-model-2 |
challenger ONNX (onnx2 eval) |
— |
Sidecar fallback (HTTP, still supported):
make sidecar # python training/inference_server.py on :8080
bin/gofer -gtp -size 9 -eval onnx -eval-backend sidecar -onnx-url http://127.0.0.1:8080Parity harness — proves Go ORT matches Python inference_server.Session bit-exact (ORT 1.26.0):
# quick (500 positions)
bash scripts/parity-onnx.sh
# full samples file
GOFER_PARITY_LIMIT=1722 bash scripts/parity-onnx.shRequires onnxruntime==1.26.0 on the Python side (training/requirements-ort-parity.txt or pip). Linux amd64 also needs ONNXRUNTIME_SHARED_LIBRARY_PATH (script downloads ORT 1.26.0 if missing). Go test: CGO_ENABLED=1 go test -tags=onnx ./cmd/gofer/ -run TestONNXParityPythonRef.
See ADR 0004.
Equal-config ONNX strength check (200 games, same playouts):
make sidecar
make reproduce-9x9-onnx-gateLegacy asymmetric heuristic gate (600 vs 200 playouts):
bin/gofer -arena -games 200 -size 9 -playouts 400 \
-black-playouts 600 -white-playouts 200 \
-black-eval heuristic -white-eval heuristic -seed 42 \
-arena-enhanced baseline \
-json .tectonix/reports/arena-report.jsonbin/gofer -selfplay -games 5 -size 9 -playouts 200 -selfplay-eval mix -o samples.jsonl
bin/gofer -selfplay -games 3 -size 9 -sgf-dir games/Persistent replay buffer, resume training, monotonic arena promote:
SEED_FROM_CYCLE2=1 WEEK_DAYS=14 bash scripts/train-loop-v3.sh
# Lightsail: bash scripts/aws-run-arena.sh IP start-v3See docs/decisions/0003-iterative-training-loop.md.
bin/gofer -sgf cmd/gofer/testdata/simple.sgf| Board | Default playouts (when -playouts 0) |
|---|---|
| 9×9 | 400 |
| 13×13 | 800 |
| 19×19 | 1600 |
-think-time overrides playout count for that move (GTP time_left, -play, -analyze, -gtp).
heuristic(default) — stones, liberties, territory estimate, move priors for PUCTuniform— random-ish MCTS baselinebatched/mock-batch— batched mock inference queueonnx— ONNX Runtime via HTTP sidecar (-onnx-url,-batch-size,-eval-timeout)
make pgo-profile # generates default.pgo (gitignored)
make pgo-build # bin/gofer with -pgo=
make bench-check # compare before/aftermake pgo-profile profiles BenchmarkLegalMoves only; self-play would be a better macro workload if PGO gains matter.
| Path | Role |
|---|---|
cmd/gofer/ |
Engine binary (rules, MCTS, GTP, CLI) |
cmd/bench/ |
Benchmark regression runner |
training/ |
PyTorch bootstrap trainer + ONNX sidecar |
models/ |
Exported ONNX weights |
docs/ |
Blueprint, traceability, scorecard |
docs/implementation-blueprint.md— milestonesdocs/research-traceability.md— paper ↔ codedocs/optimization-scorecard.md— benches & quality gate
- Chinese + Tromp-Taylor rules, SGF import/export
- PUCT MCTS, transposition table, parallel playouts
- GTP subset, terminal play/analyze/watch, self-play samples
- Arena gating, Wilson CI, training sample export
- ONNX sidecar inference (
-eval onnx), bootstrap 9×9 net
- KataGo-level strength or full analysis API
- In-process ONNX (CGO); sidecar is v2.5 default
- Full time controls (byo-yomi);
time_leftuses remaining time as next-move budget