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

evaluatefunction

The score of a position for side, with the other side to move, as a game where bearing off first wins. Large positive or negative numbers are a game won or lost; evaluateFor turns it over for a game played to lose.

Import it

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

Definition

function evaluate(spec: VariantSpec, position: Position, side: Side, weights?: EvaluationWeights): number

Parameters

NameTypeDescription
specVariantSpec

The native variant specification.

positionPosition

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

sideSide

The side being examined: white or black.

weights (optional)EvaluationWeights

Optional weights for the native position evaluation.

Returns

number

The score of a position for side, with the other side to move, as a game where bearing off first wins. Large positive or negative numbers are a game won or lost; evaluateFor turns it over for a game played to lose.

Examples

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

const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(evaluate(spec,position,"white"));
5.6

What it prints (run when this page was built)

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