Skip to content

Site: play the real Gofer in your browser (WebAssembly + onnxruntime-web) - #2

Merged
DevomB merged 2 commits into
v3-engine-rewrite-and-selfplay-trainingfrom
site-play-gofer-in-browser
Oct 23, 2026
Merged

DevomB merged 2 commits into
v3-engine-rewrite-and-selfplay-trainingfrom
site-play-gofer-in-browser

Conversation

@DevomB

@DevomB DevomB commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Summary

Rebuilds the landing page around the real engine: visitors can now play Gofer in the browser, and the hero replays a real win over GNU Go instead of a 19×19 human game from 1846. Stacked on #1 (base: v3-engine-rewrite-and-selfplay-training).

Changes

Play the real engine in the browser

  • cmd/gofer-wasm: the rules and MCTS search compiled to WebAssembly (2.6 MB, 0.77 MB gzipped). Network evaluations go through an async JS callback to onnxruntime-web 1.26.0 (pinned, from jsDelivr), so the browser runs the same search and the same gofer-9x9.onnx as bin/gofer.
  • web/engine.js loads the runtime, network and engine only when someone presses Play (~5 MB once). In headless Chromium a 400-visit move takes ~2 s single-threaded.
  • Play mode: choose a color, strength (100 / 400 / 1600 visits), pass, undo, new game; live candidate moves and a win-rate bar while Gofer thinks; final score under area scoring.

Hero, content and assets

  • Watch mode replays a real game from the evaluation: GNU Go 3.8 level 10 (Black) vs Gofer at 400 visits, W+12.5.
  • Elo-by-generation chart (inline SVG drawn at the container's pixel width, so labels stay legible on phones).
  • Regenerated og-image.png from that game's final position (the old one advertised v2's arena gate and line counts).
  • Mobile fixes: eyebrow and board labels no longer wrap or truncate badly; the hero no longer shifts when switching tabs.

Production build

  • Tailwind is compiled at build time (make site → web/site.css, 23 KB) instead of the runtime play CDN; scripts moved to web/site.js / web/engine.js; index.html 85 KB → 54 KB.
  • Build outputs (web/site.css, web/engine/*) are committed so Vercel (or any static host) serves web/ with no build step.
  • CI vets and builds the WebAssembly engine.

Engine

  • Search.PassWins: after the opponent passes, GTP, arena, terminal play and the browser engine pass immediately when passing already wins on the area count, instead of filling their own territory first.

Test plan

  • go test ./..., go vet (pure Go, -tags onnx, GOOS=js GOARCH=wasm), pytest
  • Headless Chromium against a local server (onnxruntime-web served from the pinned npm package): replay autoplays; Play as Black (E5 → Gofer replies, win bar updates, occupied point rejected, undo); Play as White (Gofer opens, pass → Gofer passes → "Gofer wins B+73.5"); "new" and tab switching; no page errors
  • Desktop (1366 px) and phone (390 px) full-page screenshots; no horizontal scroll
  • Check the Vercel preview on a real phone and desktop browser (fonts and jsDelivr were blocked in the build sandbox)

Generated by Claude Code

The network rarely proposes pass (self-play only allows it at the end), so
after an opponent's pass the engine filled its own territory before passing.
GTP, the arena, terminal play and the browser engine now pass immediately
when the area count after both passes is a win (Search.PassWins).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyK2tUFLPsLyWjy2h2erVw
- cmd/gofer-wasm: rules and search compiled to WebAssembly; the network runs
  in onnxruntime-web (web/engine.js, loaded on first play)
- Hero: play Gofer (live candidate moves and win-rate estimate) or watch a
  real win over GNU Go level 10, replacing the 19x19 human-game replay and
  the engine-less free-play board
- Elo-by-generation chart, regenerated social image from a real position
- Tailwind compiled at build time (make site) instead of the runtime play
  CDN; scripts moved to site.js/engine.js; HTML 85 KB -> 54 KB
- CI builds the WebAssembly engine

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyK2tUFLPsLyWjy2h2erVw
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
gofer Ready Ready Preview Oct 23, 2026 3:47pm UTC

@DevomB
DevomB merged commit f735617 into v3-engine-rewrite-and-selfplay-training Oct 23, 2026
9 checks passed

This branch was successfully deployed

1 active deployment
Preview — ec1eac22 Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants