Reference · Tiles, Mexican Train and replay
movesOffunction
Every move a game has made, first to last.
Import it
import { movesOf } from "@johnmorrisdotca/domino";
Definition
function movesOf(game: Pick<TrainGame, "history">): TrainMove[]
Parameters
| Name | Type | Description |
|---|---|---|
game | Pick<TrainGame, "history"> | The current immutable Mexican Train game or required fields of it. |
Returns
TrainMove[]
Every move a game has made, first to last.
Examples
import { movesOf, playTrain, 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(movesOf(moved));[ { kind: 'play', tile: 41, train: 0 } ]What it prints (run when this page was built)