CrazyEightsGame型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A GAME OF CRAZY EIGHTS: its table and moves (what is kept), and the hand
they have reached. size is the score that wins: 50, 100 or 200.
インポート
import type { CrazyEightsGame } from "@johnmorrisdotca/toranpu/crazy-eights";
定義
type CrazyEightsGame = KeptCardGame<CrazyEightsMove> & {
hand: number;
phase: "playing" | "over";
hands: CardId[][];
stock: CardId[];
discard: CardId[];
suit: CardSuit;
toPlay: number | null;
drawn: CardId | null;
passes: number;
turnovers: number;
scores: number[];
results: CrazyEightsResult[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
size | number | |
players | readonly string[] | |
computers | readonly boolean[] | |
seed | number | |
moves | readonly CrazyEightsMove[] | |
hand | number | Which hand this is, from 0: it decides who plays first, round the table. |
phase | "playing" | "over" | |
hands | string[][] | |
stock | string[] | The stock, face down, top card first. |
discard | string[] | The discard pile, face up, the top card last. |
suit | CardSuit | The suit to follow: the top card's, or the one called when an eight was played. |
toPlay | number | null | |
drawn | string | null | The card the player to move has just drawn, the only one they may now play; null before they draw. |
passes | number | Turns passed in a row with nothing to draw: when every player has, the hand is blocked. |
turnovers | number | How many times the discards have been shuffled into a new stock this hand. |
scores | number[] | Each seat's points so far: the first to the game's size wins. |
results | CrazyEightsResult[] |
例
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { CrazyEightsGame } from "@johnmorrisdotca/toranpu/crazy-eights";
const names = Array.from({ length: CARD_GAME_TABLES.crazyEights.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("crazyEights", { players: names, seed: 42 })!;
const value: CrazyEightsGame = game;
console.log(value.phase);playing出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。