Reference · Tiles, Mexican Train and replay
TrainHistorytype
One link of a game's record: a move, and every move before it.
Import it
import type { TrainHistory } from "@johnmorrisdotca/domino";
Definition
type TrainHistory = {
readonly move: TrainMove;
readonly before: TrainHistory | null;
readonly count: number;
};
Members
| Name | Type | Description |
|---|---|---|
move | TrainMove | |
before | TrainHistory | null | |
count | number | How many moves the record holds, this one included. |
Examples
import { startTrain, trainMoves } from "@johnmorrisdotca/domino";
import type { TrainHistory } from "@johnmorrisdotca/domino";
const game = startTrain(9,["A","B"],42,{length:"short",doubles:"one",mexican:"any"},[false,true])!;
const value: TrainHistory = {move:trainMoves(game)[0],before:null,count:1};
console.log(value);{ move: { kind: 'play', tile: 41, train: 0 }, before: null, count: 1 }What it prints (run when this page was built)