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

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

NameTypeDescription
moveTrainMove
beforeTrainHistory | null
countnumber

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)

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