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
| Name | Type | Description |
|---|---|---|
game | Pick<TrainGame, "players" | "computers"> | The current immutable Mexican Train game or required fields of it. |
train | number | The zero-based train index; players.length is the Mexican Train. |
language | Language | 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 TrainWhat it prints (run when this page was built)