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

withCountsfunction

A copy of a position with some counts changed.

Import it

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

Definition

function withCounts(position: Position, changes: { points?: [number[], number[]]; bar?: [number, number]; reserve?: [number, number]; off?: [number, number]; }): Position

Parameters

NameTypeDescription
positionPosition

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

changes{ points?: [number[], number[]]; bar?: [number, number]; reserve?: [number, number]; off?: [number, number]; }

The replacement checker-count fields.

Returns

Position

A copy of a position with some counts changed.

Examples

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

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

What it prints (run when this page was built)

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