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

sideToActfunction

Whether a side is the one the computer would act for at this moment of a game: the side on turn, or the side that must answer a double.

Import it

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

Definition

function sideToAct(game: GameState): Side | null

Parameters

NameTypeDescription
gameGameState

The current immutable native game state.

Returns

Side | null

The side to make the next decision, or null during opening or after the game ends.

Examples

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

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

What it prints (run when this page was built)

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