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

rollOpeningfunction

The opening throw: one die for white and one for black. The higher starts. A tie changes nothing but opening, and the sides throw again. In a game opened with a roll-off the starter plays the two dice as the first roll; otherwise the starter then rolls as usual.

Import it

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

Definition

function rollOpening(game: GameState, throws: readonly [number, number]): GameState

Parameters

NameTypeDescription
gameGameState

The current immutable native game state.

throwsreadonly [number, number]

The opening die for white, then black.

Returns

GameState

The opening throw: one die for white and one for black. The higher starts. A tie changes nothing but opening, and the sides throw again. In a game opened with a roll-off the starter plays the two dice as the first roll; otherwise the starter then rolls as usual.

Examples

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

const settings = settingsFor("backgammon",{points:5,cube:true});
console.log(rollOpening(newGame(settings),[3,1]).turn);
white

What it prints (run when this page was built)

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