本文へ移動

Dominoドミノ

シード付きでドミノを配り、標準のルールとコンピューターでメキシカントレインを遊び、保存したゲームを再生します。

「ドミノ」は、英語の domino をそのまま日本語に取り入れた言葉です。 名前について(英語)

目次

リファレンス · 牌・メキシカントレイン・再生

CliSurroundings型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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

インポート

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

定義

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

メンバー

名前型説明
env (省略可)Record<string, string | undefined> | undefined

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

stdin (省略可)string | undefined

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

locale (省略可)string | undefined

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

random (省略可)(() => number) | undefined

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

例

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)] }

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/domino 1.1.4 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。