GinGame型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A GAME OF GIN RUMMY: its table and moves (what is kept), and the hand they
have reached. Two seats. size is the score that wins: 50, 100 or 150.
インポート
import type { GinGame } from "@johnmorrisdotca/toranpu/gin-rummy";
定義
type GinGame = KeptCardGame<GinMove> & {
hand: number;
phase: "draw" | "discard" | "over";
hands: CardId[][];
stock: CardId[];
discard: CardId[];
taken: CardId | null;
toPlay: number | null;
picked: CardId[][];
throws: number;
scores: number[];
results: GinResult[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
size | number | |
players | readonly string[] | |
computers | readonly boolean[] | |
seed | number | |
moves | readonly GinMove[] | |
hand | number | Which hand this is, from 0: the first to play alternates. |
phase | "over" | "discard" | "draw" | Drawing a card, throwing one, or the game over. |
hands | string[][] | |
stock | string[] | The stock, face down, top card first. |
discard | string[] | The discard pile, face up, the top card last. |
taken | string | null | The card just taken from the discard pile, which may not be thrown straight back; null otherwise. |
toPlay | number | null | |
picked | string[][] | The cards each seat has taken from the discard pile this hand and still holds: what the whole table watched them take. |
throws | number | The cards thrown this hand so far: a new hand shows how the last was laid down until each player has thrown once. |
scores | number[] | |
results | GinResult[] |
例
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { GinGame } from "@johnmorrisdotca/toranpu/gin-rummy";
const names = Array.from({ length: CARD_GAME_TABLES.ginRummy.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("ginRummy", { players: names, seed: 42 })!;
const value: GinGame = game;
console.log(value.phase);draw出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。