本文へ移動

Dominoドミノ

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

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

目次

リファレンス · 牌・メキシカントレイン・再生

TRAIN_PHASES定数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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

Pure, as the engine is: every function returns a new game and leaves the one it was given untouched. A game is its table (the set, the options, the seed, the seats) and its moves, in order; hands, trains, the boneyard and whose turn it is are always read again from those (replayTrain), so a game read back out of a browser's storage is exactly the game its moves make, or none. Every shuffle is drawn from the game's seed and the round's number, so a reload deals exactly what it dealt before.

The rules as the site plays them, most published rules' own:

  • a round is dealt round the engine double, the set's highest in the first round and one fewer each round after, which sits in the hub;
  • every player has a train of their own out of the hub, and there is one more, the Mexican Train, anybody may play on;
  • on your turn lay one tile against the open end of your own train, the Mexican Train, or any player's train whose marker is out;
  • nothing to lay: draw one tile; lay it if it goes, or put your marker out and pass (with nothing to draw, just put it out); lay on your own train and your marker comes in;
  • a double must be covered before anything else is played anywhere, and whoever lays one lays again to cover it (DoublesRule for the house rule that lets doubles be chained);
  • a round ends when somebody lays their last tile, or when nobody can lay and there is nothing left to draw; every player scores the pips left in their hand, and after the last round the lowest total wins.

インポート

import { TRAIN_PHASES } from "@johnmorrisdotca/domino";

定義

const TRAIN_PHASES: { readonly playing: "playing"; readonly roundOver: "roundOver"; readonly finished: "finished"; } = {
    playing: "playing",
    roundOver: "roundOver",
    finished: "finished",
} as const satisfies Record<TrainPhase, TrainPhase>

メンバー

名前型説明
playing"playing"
roundOver"roundOver"
finished"finished"

例

import { TRAIN_PHASES } from "@johnmorrisdotca/domino";
console.log(TRAIN_PHASES);
{ playing: 'playing', roundOver: 'roundOver', finished: 'finished' }

出力(このページを作ったときに実行した結果)

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

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