本文へ移動

Dominoドミノ

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

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

目次

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

replayTrain関数

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

A game played again from its table and its moves: what reading a kept game back does. Null if any move is one the rules would not have taken.

インポート

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

定義

function replayTrain(set: number, players: readonly string[], seed: number, options: TrainOptions, computers: readonly boolean[], moves: readonly TrainMove[]): 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.

seednumber

The seed for reproducible shuffles.

optionsTrainOptions

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

computersreadonly boolean[]

Which seats are computer-controlled, in player order.

movesreadonly TrainMove[]

Recorded native moves in chronological order.

戻り値

TrainGame | null

A game played again from its table and its moves: what reading a kept game back does. null if any move is one the rules would not have taken.

例

import { movesOf, playTrain, replayTrain, startTrain, trainMoves } from "@johnmorrisdotca/domino";

const game = startTrain(9,["A","B"],42,{length:"short",doubles:"one",mexican:"any"},[false,true])!;
const moved = playTrain(game,trainMoves(game)[0])!;
console.log(replayTrain(game.set,game.players,game.seed,game.options,game.computers,movesOf(moved))?.turn);
1

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

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

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