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

parsePositionfunction

The position that text of formatPosition's kind stands for, or null if it is not one. bar, reserve and off may be left out.

Import it

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

Definition

function parsePosition(text: string): Position | null

Parameters

NameTypeDescription
textstring

Native move notation, position text or full record specified by the signature.

Returns

Position | null

The position that text of formatPosition's kind stands for, or null if it is not one. bar, reserve and off may be left out.

Examples

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

const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(parsePosition(formatPosition(position))?.bar);
[ 0, 0 ]

What it prints (run when this page was built)

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