Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ jobs:
- name: Drive the page with a real cursor and keyboard
run: node web/test/input.mjs --url http://localhost:8123/index.html

# play.html is the same game inlined into one file, for opening from a
# disk with no server. It is generated, so it can go stale, and it loads
# under file:// where fetch is refused — so it is rebuilt, compared, and
# then actually played from a file rather than trusted.
- name: Check the one-file build still matches web/
run: node web/build/standalone.mjs --check

- name: Play the one-file build straight off the disk
run: |
node web/test/browser.mjs --url "file://$PWD/play.html" --games 1
node web/test/input.mjs --url "file://$PWD/play.html"

pipeline:
# Proves the data -> train -> export -> serve path still works end to end,
# on a dataset small enough to finish in a couple of minutes.
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ __pycache__/
*.py[cod]
.venv/
venv/
dist/
build/
/dist/
# Anchored: setuptools writes ./build, but web/build holds source.
/build/
*.egg-info/
.pytest_cache/
.mypy_cache/
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: help setup test lint typecheck check train bench figures facts api ui play \
parity parity-check selfplay browser input capture web clean all
parity parity-check selfplay browser input capture standalone web clean all
.DEFAULT_GOAL := help

PY ?= python3
Expand Down Expand Up @@ -46,6 +46,10 @@ browser: ## Load the page in Chrome and play a game (needs puppeteer-core)
capture: ## Re-record the screenshots and the clip in the README
$(NODE) web/test/capture.mjs --url http://localhost:$(PORT)/index.html

standalone: ## Rebuild play.html, the whole game in one openable file
$(NODE) web/build/standalone.mjs
$(NODE) web/test/browser.mjs --url file://$(CURDIR)/play.html --games 1

web: parity selfplay ## Every check that does not need a browser

play: ## Serve the game at http://localhost:$(PORT)
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ closed-form references.
"Quick" playback the page offers, with the bot's search pauses capped at
0.8 s. The shots are the game's, not an animation.*

**Three ways in, none of which need a toolchain.** The link above, `make play`
to serve `web/` yourself, or `play.html` — the whole game inlined into one file
that plays when you open it from a disk, offline, with no server. Download it
from the repository root and double-click it. `web/build/standalone.mjs` builds
it, and CI plays a full game from `file://` on every push so the copy cannot
quietly rot.

No install, no build step, no framework — `web/` is plain ES modules, and the
whole thing is served as static files. Aim with the mouse, drag back from the
cue ball to strike, click the cue-ball diagram to move the tip off centre. Every
Expand Down
Loading
Loading