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

Strengthtype

THE COMPUTER PLAYER, in four strengths. Each is the one before it with more care, and none of them is slow: a move takes a few milliseconds, and the strongest well under a tenth of a second in a browser.

  • random: any legal play, with equal chance. It never doubles, and takes every double.
  • greedy: the play that leaves the best position by the evaluation (evaluate), looking no further.
  • careful: weighs its best four plays by what the other side's best reply to each roll would leave.
  • strong: the same over its best ten plays.

Doubling is simple, and works as documented in the README: in a race the Keith count (see keithCount), where the rules are Keith's: double when the count of the side on roll is within 4 of the other's, redouble within 3, take when the doubler's is 2 or more above the taker's. In a position where the sides are still in contact (careful and strong only), the evaluation is turned into a chance of winning (winChance) and a side doubles at 70% and takes at 25%.

Import it

import type { Strength } from "@johnmorrisdotca/sugoroku";

Definition

type Strength = "random" | "greedy" | "careful" | "strong";

Examples

import type { Strength } from "@johnmorrisdotca/sugoroku";

const value: Strength = "greedy";
console.log(value);
greedy

What it prints (run when this page was built)

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