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

resolveRulesfunction

The rules with anything left out filled from DEFAULT_RULES. Throws if the result is not a set of rules that can be played.

Import it

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

Definition

function resolveRules(rules?: Partial<Rules>, variant?: VariantSpec): Rules

Parameters

NameTypeDescription
rules (optional)Partial<Rules>

The complete or partial native rules specified by the signature.

variant (optional)VariantSpec | undefined

The variant key or resolved specification.

Returns

Rules

The rules with anything left out filled from DEFAULT_RULES. Throws if the result is not a set of rules that can be played.

Examples

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

const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
console.log(resolveRules({points:5,cube:true},spec));
{
  points: 5,
  cube: true,
  crawford: true,
  jacoby: false,
  beaver: false,
  gammons: false
}

What it prints (run when this page was built)

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