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

parseHopsfunction

The hops a written play names, in the order written: a chain of three points is two hops, and 13/11(2) is two. Returns null for text that is not a play. -, pass, and the empty text are the play of no moves.

Import it

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

Definition

function parseHops(text: string): Hop[] | null

Parameters

NameTypeDescription
textstring

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

Returns

Hop[] | null

The hops a written play names, in the order written: a chain of three points is two hops, and 13/11(2) is two. Returns null for text that is not a play. -, pass, and the empty text are the play of no moves.

Examples

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

console.log(parseHops("8/5 6/5"));
[ { from: 8, to: 5 }, { from: 6, to: 5 } ]

What it prints (run when this page was built)

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