リファレンス
牌・メキシカントレイン・再生
import { … } from "@johnmorrisdotca/domino";
最小化と gzip 圧縮をしたサイズは 9.9 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Domino: double-nine, double-twelve and double-fifteen sets of dominoes, and Mexican Train with a computer player and a saved-game format.
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
cleanTrainName | 関数 | A seat's name as given, its spaces tidied and cut to TRAIN_NAME_MOST characters. |
CLI_MOVES_MOST | 定数 | The most moves a played game may take before the command line gives up, far above any game the rules allow. |
cliLanguage | 関数 | The language the command line speaks: --lang, or the environment's, or the system's; Japanese for ja…, English for anything else. |
CliResult | 型 | What the command line came to. |
CliSurroundings | 型 | What the command line is run in. |
computerMove | 関数 | 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. |
decodeTrain | 関数 | A kept game read back, or null for nothing kept or anything these rules cannot play out again. |
Domino | 型 | A domino in a hand or the boneyard: low * 16 + high. |
DOMINO_STRINGS | 定数 | Every string, in both languages. |
dominoLanguage | 関数 | The language a person asked for, by en or ja or a tag that begins with one: English for anything else. |
dominoSay | 関数 | A string with its braces filled in from values; a brace with no value is left as it is. |
DominoStrings | 型 | The names of the strings. |
DoublesRule | 型 | How a double is dealt with, the table's one house rule about them. |
encodeTrain | 関数 | Serialize setup and recorded legal moves so the same seeded game can be replayed. |
endsOf | 関数 | A tile's two ends, the smaller first. |
everyTile | 関数 | Every tile of a set, double-blank to its highest double, in order. |
fits | 関数 | Whether a tile has this number at either end, so it can be laid against it. |
handPips | 関数 | The pips in a hand, which count against its holder when the round ends. |
handSizeFor | 関数 | HOW MANY TILES EACH PLAYER IS DEALT, by the set and the number at the table. |
isDouble | 関数 | Both ends the same: a double, which is laid across a train and must be covered. |
laidAgainst | 関数 | The tile laid against end: turned so that end touches, the other one left open. |
LaidDomino | 型 | A domino laid in a train, turned so its from end touches the train: from * 16 + to. |
laidEnds | 関数 | A laid tile's two ends in the order it lies: the one touching the train, then the open one. |
Language | 型 | The languages Domino speaks. |
legalPlays | 関数 | Every tile the player to move may lay, and where: what moves offers, and what the table lights up. |
longestRun | 関数 | The longest run of tiles from hand that can be laid one after another against end, in the order they would be laid. |
mayLay | 関数 | 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. |
mexicanOf | 関数 | The Mexican Train's number among a game's trains: after every seat's own. |
MexicanStart | 型 | When the Mexican Train may be started. |
moveCount | 関数 | How many moves a game has made. |
movesOf | 関数 | Every move a game has made, first to last. |
openEnd | 関数 | 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. |
peopleAt | 関数 | The seats a person plays: a table with two or more of them passes the device, and covers each hand between turns. |
pipsOf | 関数 | Every pip on a tile: what it counts against its holder when a round ends. |
playTrain | 関数 | The game after that move, or null for a move that may not be made now. |
Random | 型 | A number in [0, 1), like Math.random, from a stream a seed fixes. |
replayTrain | 関数 | A game played again from its table and its moves: what reading a kept game back does. |
RoundEnding | 型 | Why a round ended: somebody played their last tile, or nobody could play and nothing was left to draw. |
RoundResult | 型 | A round's result, kept for the table of scores. |
roundsFor | 関数 | How many rounds a game of this length plays with this set: one per double, top to blank, or the first half of them. |
runCli | 関数 | Run the command line. |
seededRandom | 関数 | A stream of numbers in [0, 1) fixed by a seed. |
shuffled | 関数 | A copy of the list in a random order (Fisher–Yates); the list given is left alone. |
startTrain | 関数 | 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. |
tileOf | 関数 | The tile with these two ends, whichever order they are given in. |
tileOfLaid | 関数 | The tile a laid tile is, whichever way round it lies. |
tileWords | 関数 | A tile as a person reads it: "6–4", the larger end first, as a tile is named at the table. |
Train | 型 | 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_OPTIONS | 定数 | The options a table opens on: every round, one double at a time, and the Mexican Train open from the start. |
TRAIN_DOUBLES | 定数 | The one-double and chained-double house-rule choices. |
TRAIN_LENGTHS | 定数 | The full and short round-count choices for a game. |
TRAIN_MEXICAN | 定数 | The unrestricted and own-train-first Mexican Train opening choices. |
TRAIN_NAME_MOST | 定数 | The longest name a seat keeps. |
TRAIN_PHASES | 定数 | MEXICAN TRAIN, THE DOMINO GAME: the rules, and nothing else. |
TRAIN_PIP_BASE | 定数 | The largest set's highest double, and so the base a tile's two ends are written in (tileOf). |
TRAIN_SET_NAMES | 定数 | Each set by name, for the set-up's tiles and the card on My games. |
TRAIN_SETS | 定数 | THE SETS OFFERED, by their highest double. |
trainAgain | 関数 | The same table again, the same seats and options, with a fresh shuffle. |
TrainGame | 型 | A game, as its table and moves make it. |
TrainHistory | 型 | One link of a game's record: a move, and every move before it. |
TrainLength | 型 | How many rounds: all of them, one for every double from the set's highest down to double blank, or half as many. |
TrainMove | 型 | One move at the table. |
trainMoves | 関数 | Every move the player to move may make now; none once the game is over. |
trainName | 関数 | A train's name: "Your train", "Computer 2's train", or the Mexican Train. |
trainNews | 関数 | What the last move did, in a line, or "" before there is one: "Computer 2 laid 9–4 on Your train." |
TrainOptions | 型 | What the set-up chose, beyond the set and the players. |
TrainPhase | 型 | Whether the game is playing, awaiting the next round, or finished. |
trainPlayerName | 関数 | 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. |
TrainSeat | 型 | Who sits where: 0 is the first player, round the table in the order the set-up named them. |
trainSeatName | 関数 | 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. |
trainSetLabel | 関数 | The set's name by its highest double ("Double-twelve"), or null for a number that is no set offered. |
trainSetName | 関数 | The set's name, or null for a number that is no set offered. |
trainStatus | 関数 | 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. |
trainTotals | 関数 | Each seat's total over every round played: the lowest wins. |
VERSION | 定数 | The package's version. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。