Skip to the content

Sugoroku双六

Play backgammon and its relatives with native rules, cube and match scoring, seeded dice and replayable records.

Sugoroku is the Japanese name 双六 for games of tables. About the name

Contents

Reference

SVG boards and notation

import { … } from "@johnmorrisdotca/sugoroku/draw";

5.2 kB minified and gzipped, with everything it imports (measured with esbuild)

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. A separate entry (@johnmorrisdotca/sugoroku/draw), so a server that only checks a game never loads any of it.

Exports

NameKindWhat it is
BoardLayoutclassThe layout of a board, a function of its options: where each point, the bar, each tray, the rail and the dice sit, all in landscape units.
BoardOptionstypeThe cube, viewing side, home direction and orientation used to calculate board geometry.
boardSizefunctionThe width and height the board is drawn in, which is the other way about when it stands up.
BoxtypeA box: where something is, in landscape units before any turning.
colourPropertyfunctionThe custom property a colour is set on.
colourStylefunctionThe inline custom properties of a drawing: the named board and checkers, then any colour given.
drawSugorokufunctionThe board as SVG text for position.
MOST_DRAWNconstantHow many checkers are drawn on a stack before the last one carries the count.
OrientationtypeWhether the board lies across the page or stands up in it.
SUGOROKU_BOARD_NAMESconstantThe names of the boards.
SUGOROKU_BOARDSconstantThe boards the drawing knows by name, set against any theme.
SUGOROKU_CHECKER_SET_NAMESconstantThe names of the checker sets.
SUGOROKU_CHECKER_SETSconstantThe checkers the drawing knows by name.
SUGOROKU_COLOUR_NAMESconstantThe names of the colours, as the custom properties spell them (--sg- and the name in kebab case).
SUGOROKU_STYLEconstantTHE STYLE a Sugoroku board is drawn with: colours as custom properties (--sg-felt, --sg-white and the rest of SugorokuColours), light by default and dark when the device is, and the one rule that matters for a game played with fingers and a mouse: nothing on the board can be selected, dragged or double-tapped.
SugorokuBoardNametypeA named board, a set of colours for the board and its points.
SugorokuCheckerSetNametypeA named pair of checker colours.
SugorokuColourstypeTHE COLOURS OF A BOARD.
SugorokuDrawOptionstypeWhat to draw with.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/sugoroku 1.1.1.