本文へ移動

Dominoドミノ

シード付きでドミノを配り、標準のルールとコンピューターでメキシカントレインを遊び、保存したゲームを再生します。

「ドミノ」は、英語の domino をそのまま日本語に取り入れた言葉です。 名前について(英語)

目次

リファレンス

牌・メキシカントレイン・再生

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.

ソースを見るGitHub で編集@johnmorrisdotca/domino 1.1.4 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。