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 · Rules, games and records

diceToPlayfunction

The dice a roll gives to play, highest first: a double of a game that plays doubles four times is four of them.

Import it

import { diceToPlay } from "@johnmorrisdotca/sugoroku";

Definition

function diceToPlay(spec: VariantSpec, roll: readonly number[]): number[]

Parameters

NameTypeDescription
specVariantSpec

The native variant specification.

rollreadonly number[]

The valid dice as thrown, in throw order.

Returns

number[]

The dice a roll gives to play, highest first: a double of a game that plays doubles four times is four of them.

Examples

import { diceToPlay, settingsFor } from "@johnmorrisdotca/sugoroku";

const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
console.log(diceToPlay(spec,[3,3]));
[ 3, 3, 3, 3 ]

What it prints (run when this page was built)

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