Skip to the content

Domino documentation

Domino API: every export

Every export of every entry point, each with its own page. This page keeps the addresses the old one-page reference had.

@johnmorrisdotca/domino/tile-sounds

MOST_SOUNDS_AT_ONCEconstant

As many sounds as one call plays: fifteen tiles drawn are eight clicks, not a wall of noise.

soundTimesfunction

When each of count sounds starts, in milliseconds from the first: one every gap, and no more than MOST_SOUNDS_AT_ONCE, spread over the same time.

TileSoundDatatype

The recordings, by name (lay-2), as base64 AAC.

TileSoundKindtype

One kind of sound: shuffle the tiles stirred face down, draw a tile taken from the boneyard, lay a tile set down on a train, knock a rap on the table, which is how a pass is announced.

TileSoundstype

A table's sounds: play one, mute and unmute, change the volume, close when the table goes.

TileSoundWindowtype

The parts of a window the sounds use: an audio context and atob.

@johnmorrisdotca/domino/sounds

TILE_SOUND_DATAconstant

The tile sounds, recorded: tiles shuffled, drawn, laid and knocked on the table, as base64 AAC (.m4a).

TileSoundFiletype

The name of one recording: its kind of sound and a number, such as lay-2.

@johnmorrisdotca/domino

cleanTrainNamefunction

A seat's name as given, its spaces tidied and cut to TRAIN_NAME_MOST characters.

CLI_MOVES_MOSTconstant

The most moves a played game may take before the command line gives up, far above any game the rules allow.

cliLanguagefunction

The language the command line speaks: --lang, or the environment's, or the system's; Japanese for ja…, English for anything else.

computerMovefunction

The move the computer in the seat to move makes now: the best-scored lay, or the draw, pass or next round it must take.

decodeTrainfunction

A kept game read back, or null for nothing kept or anything these rules cannot play out again.

Dominotype

A domino in a hand or the boneyard: low * 16 + high.

dominoLanguagefunction

The language a person asked for, by en or ja or a tag that begins with one: English for anything else.

dominoSayfunction

A string with its braces filled in from values; a brace with no value is left as it is.

DoublesRuletype

How a double is dealt with, the table's one house rule about them.

encodeTrainfunction

Serialize setup and recorded legal moves so the same seeded game can be replayed.

endsOffunction

A tile's two ends, the smaller first.

everyTilefunction

Every tile of a set, double-blank to its highest double, in order.

fitsfunction

Whether a tile has this number at either end, so it can be laid against it.

handPipsfunction

The pips in a hand, which count against its holder when the round ends.

handSizeForfunction

HOW MANY TILES EACH PLAYER IS DEALT, by the set and the number at the table.

isDoublefunction

Both ends the same: a double, which is laid across a train and must be covered.

laidAgainstfunction

The tile laid against end: turned so that end touches, the other one left open.

LaidDominotype

A domino laid in a train, turned so its from end touches the train: from * 16 + to.

laidEndsfunction

A laid tile's two ends in the order it lies: the one touching the train, then the open one.

Languagetype

The languages Domino speaks.

legalPlaysfunction

Every tile the player to move may lay, and where: what moves offers, and what the table lights up.

longestRunfunction

The longest run of tiles from hand that can be laid one after another against end, in the order they would be laid.

mayLayfunction

Whether the player to move may lay this tile on this train now: the same answer legalPlays gives, for one tile, without listing every other.

mexicanOffunction

The Mexican Train's number among a game's trains: after every seat's own.

moveCountfunction

How many moves a game has made.

movesOffunction

Every move a game has made, first to last.

openEndfunction

The number a train's next tile must match: its last tile's open end, or the engine double's when nothing is laid on it yet.

peopleAtfunction

The seats a person plays: a table with two or more of them passes the device, and covers each hand between turns.

pipsOffunction

Every pip on a tile: what it counts against its holder when a round ends.

playTrainfunction

The game after that move, or null for a move that may not be made now.

Randomtype

A number in [0, 1), like Math.random, from a stream a seed fixes.

replayTrainfunction

A game played again from its table and its moves: what reading a kept game back does.

RoundEndingtype

Why a round ended: somebody played their last tile, or nobody could play and nothing was left to draw.

RoundResulttype

A round's result, kept for the table of scores.

roundsForfunction

How many rounds a game of this length plays with this set: one per double, top to blank, or the first half of them.

runClifunction

Run the command line.

seededRandomfunction

A stream of numbers in [0, 1) fixed by a seed.

shuffledfunction

A copy of the list in a random order (Fisher–Yates); the list given is left alone.

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.

tileOffunction

The tile with these two ends, whichever order they are given in.

tileOfLaidfunction

The tile a laid tile is, whichever way round it lies.

tileWordsfunction

A tile as a person reads it: "6–4", the larger end first, as a tile is named at the table.

Traintype

A train on the table: the tiles laid on it in order, and whether its owner's marker says anybody may play on it.

TRAIN_DEFAULT_OPTIONSconstant

The options a table opens on: every round, one double at a time, and the Mexican Train open from the start.

TRAIN_DOUBLESconstant

The one-double and chained-double house-rule choices.

TRAIN_LENGTHSconstant

The full and short round-count choices for a game.

TRAIN_MEXICANconstant

The unrestricted and own-train-first Mexican Train opening choices.

TRAIN_PHASESconstant

MEXICAN TRAIN, THE DOMINO GAME: the rules, and nothing else.

TRAIN_PIP_BASEconstant

The largest set's highest double, and so the base a tile's two ends are written in (tileOf).

TRAIN_SET_NAMESconstant

Each set by name, for the set-up's tiles and the card on My games.

TRAIN_SETSconstant

THE SETS OFFERED, by their highest double.

trainAgainfunction

The same table again, the same seats and options, with a fresh shuffle.

TrainGametype

A game, as its table and moves make it.

TrainHistorytype

One link of a game's record: a move, and every move before it.

TrainLengthtype

How many rounds: all of them, one for every double from the set's highest down to double blank, or half as many.

trainMovesfunction

Every move the player to move may make now; none once the game is over.

trainNamefunction

A train's name: "Your train", "Computer 2's train", or the Mexican Train.

trainNewsfunction

What the last move did, in a line, or "" before there is one: "Computer 2 laid 9–4 on Your train."

TrainOptionstype

What the set-up chose, beyond the set and the players.

TrainPhasetype

Whether the game is playing, awaiting the next round, or finished.

trainPlayerNamefunction

A seat's name as the table reads it: the one given, or "Computer 3" for a computer's seat left blank, "Player 3" for a person's.

TrainSeattype

Who sits where: 0 is the first player, round the table in the order the set-up named them.

trainSeatNamefunction

A seat's name: the one given at the table, or "You" for the person at this device, or "Computer 3" or "Player 3" for the seat's number.

trainSetLabelfunction

The set's name by its highest double ("Double-twelve"), or null for a number that is no set offered.

trainSetNamefunction

The set's name, or null for a number that is no set offered.

trainStatusfunction

What is going on, in a line: who is to play, or what the person at you is asked to do (lay, cover a double, draw, pass), or how the round or the game ended.

trainTotalsfunction

Each seat's total over every round played: the lowest wins.

VERSIONconstant

The package's version.