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 · Playable board

createSoundsfunction

A player for the sounds, which makes its audio only when first asked to play, as browsers insist on a gesture first. Plays nothing where there is no audio.

Import it

import { createSounds } from "@johnmorrisdotca/sugoroku/play";

Definition

function createSounds(urls: SoundUrls): SoundPlayer

Parameters

NameTypeDescription
urlsPartial<Record<SoundName, string>>

Optional URLs of the native board sounds.

Returns

SoundPlayer

A player for the sounds, which makes its audio only when first asked to play, as browsers insist on a gesture first. Plays nothing where there is no audio.

Examples

import { legalPlaysOf, newGame, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
import { createSounds } from "@johnmorrisdotca/sugoroku/play";

const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const play = legalPlaysOf(game)[0];
const sounds = createSounds({});
console.log(typeof sounds.play);
sounds.destroy();

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