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

Playable board

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

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

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

Exports

NameKindWhat it is
createSoundsfunctionA player for the sounds, which makes its audio only when first asked to play, as browsers insist on a gesture first.
ensureSugorokuPlayStylefunctionPut the style in the page once: in the document's head, or in the shadow root the host is in.
mountSugorokufunctionMount a board into host.
packagedSoundsfunctionThe sounds' addresses beside the package's code, or an empty set where import.meta.url is not an address (some test runners).
SoundNametypeTHE SOUNDS OF A BOARD, optional: a checker set down, a checker hit, the dice and the cube.
SoundPlayertypeOptional board-sound playback and cleanup methods.
SoundUrlstypeThe address of each sound.
SUGOROKU_PLAY_STYLEconstantTHE STYLE a playable Sugoroku board wears (mountSugoroku, <sugoroku-board>): the drawing's own (SUGOROKU_STYLE), the board's box, its buttons and its lines of words.
SUGOROKU_STRINGSconstantThe native English and Japanese labels, announcements and interpolation templates.
SugorokuEventDetailtypeWhat every event of the board carries.
SugorokuLanguagetypeTHE WORDS A SUGOROKU BOARD SAYS, in English and Japanese: the buttons, the line that says whose turn it is and what to do, and the result of a game.
sugorokuLanguageOffunctionThe language an element or its page is in: its own lang, or the nearest above, and English unless that begins with ja.
SugorokuLooktypeHow the board looks, apart from the game.
SugorokuMounttypeThe mounted native board, current game/match/record, actions and cleanup handle.
SugorokuMountOptionstypeNative variant, rules, seed, computer, display, control, sound and event-callback choices.
sugorokuSayfunctionA line in a language with its {name}s filled in.

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