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

positionKeyfunction

A position as a short string that is the same for the same position, for keeping a set of them.

Import it

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

Definition

function positionKey(position: Position): string

Parameters

NameTypeDescription
positionPosition

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

Returns

string

A position as a short string that is the same for the same position, for keeping a set of them.

Examples

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

const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(positionKey(position));
0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2|0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2|0,0|0,0|0,0

What it prints (run when this page was built)

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