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

opponentAtfunction

How many of the other side's checkers stand on the point that is side's own point own.

Import it

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

Definition

function opponentAt(spec: VariantSpec, position: Position, side: Side, own: number): 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.

ownnumber

A point in this side’s own numbering.

Returns

number

How many of the other side's checkers stand on the point that is side's own point own.

Examples

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

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

What it prints (run when this page was built)

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