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

positionIdfunction

The ID of a position with onRoll to move, or null if it cannot be written in this form.

Import it

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

Definition

function positionId(position: Position, onRoll: Side): string | null

Parameters

NameTypeDescription
positionPosition

The native checker counts, bar, reserve and borne-off counts.

onRollSide

The side to roll, or whether this evaluated side is on roll, specified by the signature.

Returns

string | null

The ID of a position with onRoll to move, or null if it cannot be written in this form.

Examples

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

const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(positionId(position,"white"));
4HPwATDgc/ABMA

What it prints (run when this page was built)

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