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

trainNamefunction

A train's name: "Your train", "Computer 2's train", or the Mexican Train.

Import it

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

Definition

function trainName(game: Pick<TrainGame, "players" | "computers">, train: number, language: Language, you?: TrainSeat): string

Parameters

NameTypeDescription
gamePick<TrainGame, "players" | "computers">

The current immutable Mexican Train game or required fields of it.

trainnumber

The zero-based train index; players.length is the Mexican Train.

languageLanguage

The English or Japanese display language.

you (optional)number | undefined

The zero-based seat at this device; omit when no seat is local.

Returns

string

A train's name: "Your train", "Computer 2's train", or the Mexican Train.

Examples

import { mexicanOf, startTrain, trainName } from "@johnmorrisdotca/domino";

const game = startTrain(9,["A","B"],42,{length:"short",doubles:"one",mexican:"any"},[false,true])!;
console.log(trainName(game,mexicanOf(game),"en",0));
Mexican Train

What it prints (run when this page was built)

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