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 · SVG boards and notation

drawSugorokufunction

The board as SVG text for position. The variant says how the sides' points line up; pass the same one the game is played with.

Import it

import { drawSugoroku } from "@johnmorrisdotca/sugoroku/draw";

Definition

function drawSugoroku(position: Position, options?: SugorokuDrawOptions): string

Parameters

NameTypeDescription
positionPosition

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

options (optional)SugorokuDrawOptions

Native drawing, geometry, mounting or computer choices specified by the signature.

Returns

string

The board as SVG text for position. The variant says how the sides' points line up; pass the same one the game is played with.

Examples

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

const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(drawSugoroku(position,{variant:"backgammon",label:"Starting board"}).startsWith("<svg"));
true

What it prints (run when this page was built)

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