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 · Board and position elements

SugorokuElementOptionstype

Host mount options, including custom colours, names, a match and callbacks.

Import it

import type { SugorokuElementOptions } from "@johnmorrisdotca/sugoroku/element";

Also exported from: @johnmorrisdotca/sugoroku/element/define

Definition

type SugorokuElementOptions = SugorokuMountOptions;

Members

NameTypeDescription
board (optional)SugorokuBoardName | undefined
checkers (optional)SugorokuCheckerSetName | undefined
colours (optional)Partial<SugorokuColours> | undefined
theme (optional)"auto" | "light" | "dark" | undefined
home (optional)"left" | "right" | undefined

Which end of the board the trays are at.

view (optional)Side | "auto" | undefined

Whose home board is at the bottom: auto (the default) is the side a person plays when the computer plays the other, otherwise white.

numbers (optional)boolean | undefined

Numbers on the points.

orientation (optional)Orientation | "auto" | undefined

auto (the default) stands the board up in a narrow page, such as a phone's.

variant (optional)VariantKey | undefined

The variant. Default backgammon.

rules (optional)Partial<Rules> | undefined

The rules left out are a single game with no cube.

preset (optional)string | undefined

A named way of playing (a PRESETS key, such as backgammon-5) instead of variant and rules.

seed (optional)RecordSeed | undefined

Dice from a seed, so the game can be played again; left out they are random.

dice (optional)"button" | "host" | undefined

button (the default): a button rolls them. host: the page gives them, with roll, when sugoroku-need-dice says they are wanted.

computer (optional){ white?: Strength | null; black?: Strength | null; } | undefined

The strength of the computer for each side it plays. A side left out, or null, is played by a person.

computerDelay (optional)number | undefined

How long the computer pauses between what it does, in milliseconds. Default 450, and none for a reader who has asked for less motion.

controls (optional)boolean | undefined

The buttons and the lines of words. Default true.

drag (optional)boolean | undefined

Whether a checker may be dragged as well as tapped. Default true.

autoEnd (optional)boolean | undefined

End a turn at once when it is played out, without waiting for Done. Default false.

language (optional)SugorokuLanguage | undefined

The language the words are in. Left out, the host's own lang, or the page's, and it follows the page's.

names (optional)Partial<Record<Side, string>> | undefined

What each side is called, instead of its colour or You and Computer.

sound (optional)boolean | Partial<Record<SoundName, string>> | undefined

Sounds: true for the package's own, or the address of each. Default none.

match (optional)Match | undefined

Carry on a match already begun.

onRoll (optional)((detail: SugorokuEventDetail) => void) | undefined
onMove (optional)((detail: SugorokuEventDetail) => void) | undefined
onTurn (optional)((detail: SugorokuEventDetail) => void) | undefined
onCube (optional)((detail: SugorokuEventDetail) => void) | undefined
onEnd (optional)((detail: SugorokuEventDetail) => void) | undefined

Examples

import type { SugorokuElementOptions } from "@johnmorrisdotca/sugoroku/element";
const options: SugorokuElementOptions = {};
console.log(Object.keys(options).length); // 0
0

What it prints (run when this page was built)

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