Sugoroku documentation
Sugoroku 双六 — Backgammon and its variants
Play backgammon and its relatives with native rules, cube and match scoring, seeded dice and replayable records.
Install
npm install @johnmorrisdotca/sugoroku
Start here
Entry points
| Import it | What it is | Size |
|---|---|---|
@johnmorrisdotca/SVG boards and notation · 19 exports | Sugoroku's drawing: SVG text for a board with its checkers, dice and cube, the style that makes it a board, and the colours it is made of. | 5.2 kB |
@johnmorrisdotca/Playable board · 16 exports | Sugoroku, played in a page: mountSugoroku draws a game into any element and plays it by touch and mouse, with the doubling cube, Undo, the computer for either side or both, optional sounds, and the words in English and Japanese. | 20.3 kB |
@johnmorrisdotca/Board and position elements · 10 exports | 24.4 kB | |
@johnmorrisdotca/Register the elements · 10 exports | 24.4 kB | |
@johnmorrisdotca/Rules, games and records · 134 exports | Pure backgammon and variant rules, legal turns, cube and match scoring, dice, records and computer choices. | 11.6 kB |
Guides
How-to
- Play legal turns and undo movesDistinguish a move from a full turn and honor required dice.
- Choose variants and named presetsResolve a variant separately from cube and match rules.
- Handle the cube and match scoreOffer, take or drop only in the allowed phase.
- Write notation and replay recordsKeep chronological actions and verify a record against native rules.
- Draw and embed boards or positionsChoose a static diagram or a native playable board.
Explanation
- Computer choices and reproducible diceSeparate legal decisions, random ties and time-limited lookahead.
- Architecture and immutable stateFollow the board, move, turn, game and match layers.