Reference
Go rules
import { … } from "@johnmorrisdotca/narabe/rules/go";
5.8 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
applyGoMove | function | A stone of stone played at point: the board it leaves, and what it captured — or null, meaning the move is suicide and illegal. |
areaWinner | function | The colour whose area plus komi wins the Go position. |
goLegal | function | Whether stone may play point: on the board, empty, not suicide, and not the one point the simple ko rule forbids retaking this move — exactly the point a single-stone capture just vacated, so the immediate recapture cannot instantly restore the position it broke. |
groupAt | function | The connected group of stones sharing the colour at from, and the empty points touching any of them — its liberties. |
KOMI | constant | Go: stones never move once played, and nothing about a line ever decides anything. |
playGoMove | function | Plays a stone at point, already known legal: captures whatever it takes, sets a fresh ko point when that capture was exactly one stone (and clears it otherwise), and passes the turn — Go has no further move of its own to settle, unlike the twist games or a piece game's line. |
scoreArea | function | The area score: every stone on the board, plus every empty region whose only neighbours are one colour. |
walledIn | function | The empty points stone has already walled in: every empty region whose border is that colour's stones and nothing else — the ground scoreArea counts as theirs. |