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

SugorokuColourstype

THE COLOURS OF A BOARD. Every colour the drawing uses is one of these, set as a custom property on the drawing (--sg-felt and so on), so a page's own style may change any of them, and drawSugoroku takes any of them as an option. Where a colour is left out the drawing uses the theme's: light by default, dark when the device is (see SUGOROKU_STYLE).

Import it

import type { SugorokuColours } from "@johnmorrisdotca/sugoroku/draw";

Definition

type SugorokuColours = {
    frame: string;
    felt: string;
    pointA: string;
    pointB: string;
    bar: string;
    tray: string;
    white: string;
    whiteEdge: string;
    black: string;
    blackEdge: string;
    number: string;
    selected: string;
    target: string;
    die: string;
    pip: string;
    cube: string;
    cubeInk: string;
};

Members

NameTypeDescription
framestring

The frame the board is set in.

feltstring

The playing surface.

pointAstring

The points, alternately.

pointBstring
barstring

The bar, and the trays' floor.

traystring
whitestring

The checkers: the face and the rim of each side's.

whiteEdgestring
blackstring
blackEdgestring
numberstring

The numbers on the points, and a count on a tall stack.

selectedstring

What marks the checker picked up, and the places it may go.

targetstring
diestring

The dice and the cube.

pipstring
cubestring
cubeInkstring

Examples

import type { SugorokuColours } from "@johnmorrisdotca/sugoroku/draw";
import { SUGOROKU_COLOUR_NAMES } from "@johnmorrisdotca/sugoroku/draw";

const value: SugorokuColours = Object.fromEntries(SUGOROKU_COLOUR_NAMES.map(name=>[name,"#ffffff"])) as SugorokuColours;
console.log(value);
{
  frame: '#ffffff',
  felt: '#ffffff',
  pointA: '#ffffff',
  pointB: '#ffffff',
  bar: '#ffffff',
  tray: '#ffffff',
  white: '#ffffff',
  whiteEdge: '#ffffff',
  black: '#ffffff',
  blackEdge: '#ffffff',
  number: '#ffffff',
  selected: '#ffffff',
  target: '#ffffff',
  die: '#ffffff',
  pip: '#ffffff',
  cube: '#ffffff',
  cubeInk: '#ffffff'
}

What it prints (run when this page was built)

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