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

Playtype

A WHOLE TURN: the moves a side makes with a roll, in the order it makes them, and the position they leave.

Import it

import type { Play } from "@johnmorrisdotca/sugoroku";

Definition

type Play = {
    readonly moves: readonly Move[];
    readonly position: Position;
};

Members

NameTypeDescription
movesreadonly Move[]
positionPosition

Examples

import { legalPlaysOf, newGame, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
import type { Play } from "@johnmorrisdotca/sugoroku";

const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const play = legalPlaysOf(game)[0];
const value: Play = play;
console.log(value);
{
  moves: [
    { from: 24, to: 21, die: 3, hit: false },
    { from: 24, to: 23, die: 1, hit: false }
  ],
  position: {
    points: [ [Array], [Array] ],
    bar: [ 0, 0 ],
    reserve: [ 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.