WarGame型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A GAME OF WAR: its table and moves (what is kept), and what they make. size is how many turns it may last, and hands
are each player's cards, face down, the top card first. Nothing here is hidden: no player chooses anything.
インポート
import type { WarGame } from "@johnmorrisdotca/toranpu/war";
定義
type WarGame = KeptCardGame<WarMove> & {
phase: "playing" | "over";
hands: CardId[][];
toPlay: number | null;
last: WarTurn | null;
ended: WarEnd | null;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
size | number | |
players | readonly string[] | |
computers | readonly boolean[] | |
seed | number | |
moves | readonly WarMove[] | |
phase | "playing" | "over" | |
hands | string[][] | Each player's pile, top card first. |
toPlay | number | null | The seat the table waits on: the first person's, or the first seat when computers hold both. Null once over. |
last | WarTurn | null | The last turn, for the table to show; null before the first. |
ended | WarEnd | null | Why the game ended; null while it goes on. |
例
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { WarGame } from "@johnmorrisdotca/toranpu/war";
const names = Array.from({ length: CARD_GAME_TABLES.war.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("war", { players: names, seed: 42 })!;
const value: WarGame = game;
console.log(value.phase);playing出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。