How it's checked
Go's rules have corners that are easy to get wrong: captures that leave a group without liberties, ko, suicide, seki, and how territory is counted. Goban checks its rules and scoring in three ways besides its ordinary tests.
None of this runs in the browser. These are development tools, and the package you install contains only the JavaScript.
A reference model in Lean
The verify/ folder holds the rules and the count of a finished game written in Lean, with proofs about them. Among other things, the proofs show that:
- an accepted move removes exactly the opponent groups it leaves without liberties, and never the mover's own stones;
- no position reachable by play has a group without liberties;
- every point is counted once, and komi only changes White's score;
- marking a group seki never changes an area score and never raises a territory score.
Node tests then compare the JavaScript rules engine and scorer with the Lean model after every action and on every final count.
The proofs cover the Lean model, not the JavaScript. The tests are what tie the two together. The Lean README lists exactly what is and isn't proved.
Models in TLA+
The tla/ folder holds TLA+ models of the rules engine and of the game core: game values, play and review modes, phases, and results. A model checker tries every reachable state on small boards and checks properties in each one.
Lean proves the rules for every board size but doesn't model the game tree or modes. TLA+ covers that part, within small bounds. Random runs of both models are replayed through the JavaScript, which has to agree with the model after every step.
See the TLA+ README for the models and what they found.
SGF files from other programs
As an optional check, the SGF reader has been run over published records: the five AlphaGo–Lee Sedol games, the Sabaki project's test files (including Shift_JIS and UTF-16 files), and a large joseki dictionary. The AlphaGo games' positions matched the Lean model move by move, the Sabaki files opened, and the joseki dictionary saved back byte for byte, though one of its records holds a move the rules refuse. SGF-CORPUS.md has the details and how to repeat it.