Reference · Tiles, Mexican Train and replay
startTrainfunction
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 it
import { startTrain } from "@johnmorrisdotca/domino";
Definition
function startTrain(set: number, players: readonly string[], seed?: number, options?: TrainOptions, computers?: readonly boolean[]): TrainGame | null
Parameters
| Name | Type | Description |
|---|---|---|
set | number | The highest double of the supported set: 9, 12 or 15. |
players | readonly string[] | Player count, or names in seat order, as specified by this signature. |
seed (optional) | number | The seed for reproducible shuffles. |
options (optional) | TrainOptions | Native sound-player choices or Mexican Train house rules specified by the signature. |
computers (optional) | readonly boolean[] | Which seats are computer-controlled, in player order. |
Returns
TrainGame | null
The seeded game, or null for an unsupported set or player count.
Examples
import { startTrain } from "@johnmorrisdotca/domino";
console.log(startTrain(9,["A","B"],42)?.hands.map(hand=>hand.length));[ 10, 10 ]What it prints (run when this page was built)