Skip to the content

Dominoドミノ

Deal seeded dominoes, play Mexican Train with native rules and computers, and replay a saved game.

Domino is the Japanese borrowed word ドミノ for dominoes. About the name

Contents

Reference · Tiles, Mexican Train and replay

CliSurroundingstype

What the command line is run in. All of it is optional.

Import it

import type { CliSurroundings } from "@johnmorrisdotca/domino";

Definition

type CliSurroundings = {
    env?: Record<string, string | undefined>;
    stdin?: string;
    locale?: string;
    random?: () => number;
};

Members

NameTypeDescription
env (optional)Record<string, string | undefined> | undefined

The environment, for the language: LC_ALL, LC_MESSAGES and LANG.

stdin (optional)string | undefined

Standard input, when --stdin asks for it: the saved game.

locale (optional)string | undefined

The system's language where the environment names none: what Intl says, on Windows.

random (optional)(() => number) | undefined

Where a seed comes from when none is given: a function like Math.random, which it is unless given.

Examples

import type { CliSurroundings } from "@johnmorrisdotca/domino";
import { seededRandom } from "@johnmorrisdotca/domino";

const value: CliSurroundings = {locale:"ja-JP",random:seededRandom(42)};
console.log(value);
{ locale: 'ja-JP', random: [Function (anonymous)] }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/domino 1.1.4.