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

chanceOfWinningfunction

The chance, 0 to 1, that side wins from here, by the evaluation, or by the Keith count's rule of thumb in a race (as 0.5 plus a share of the count's lead).

Import it

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

Definition

function chanceOfWinning(game: GameState, side: Side): number

Parameters

NameTypeDescription
gameGameState

The current immutable native game state.

sideSide

The side being examined: white or black.

Returns

number

The chance, 0 to 1, that side wins from here, by the evaluation, or by the Keith count's rule of thumb in a race (as 0.5 plus a share of the count's lead).

Examples

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

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

What it prints (run when this page was built)

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