本文へ移動

Dominoドミノ

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

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

目次

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

startTrain関数

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

A new game: the set (its highest double), the names at the table (one a seat), which seats a computer plays, the options, and the seed every shuffle is drawn from. Null for a table the game is not offered for — a set not in PARTY_SPECS, or too few or too many players — rather than a game nobody chose.

インポート

import { startTrain } from "@johnmorrisdotca/domino";

定義

function startTrain(set: number, players: readonly string[], seed?: number, options?: TrainOptions, computers?: readonly boolean[]): TrainGame | null

引数

名前型説明
setnumber

The highest double of the supported set: 9, 12 or 15.

playersreadonly string[]

Player count, or names in seat order, as specified by this signature.

seed (省略可)number

The seed for reproducible shuffles.

options (省略可)TrainOptions

Native sound-player choices or Mexican Train house rules specified by the signature.

computers (省略可)readonly boolean[]

Which seats are computer-controlled, in player order.

戻り値

TrainGame | null

The seeded game, or null for an unsupported set or player count.

例

import { startTrain } from "@johnmorrisdotca/domino";

console.log(startTrain(9,["A","B"],42)?.hands.map(hand=>hand.length));
[ 10, 10 ]

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

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

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