SpadesGame型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A GAME OF SPADES: its table and moves (what is kept, KeptCardGame), and
everything the moves make, read again from them whenever the game is.
Four seats in two partnerships, sitting across from each other: seats 0 and
2 against 1 and 3. size is the score that ends the game: 200, 300 or 500.
インポート
import type { SpadesGame } from "@johnmorrisdotca/toranpu/spades";
定義
type SpadesGame = KeptCardGame<SpadesMove> & {
deal: number;
phase: SpadesPhase;
hands: CardId[][];
bids: (number | null)[];
trick: SpadesPlay[];
lastTrick: {
plays: SpadesPlay[];
winner: number;
} | null;
played: CardId[];
toPlay: number | null;
spadesBroken: boolean;
tricks: number[];
scores: [
number,
number
];
bags: [
number,
number
];
dealScores: SpadesDealScore[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
size | number | |
players | readonly string[] | |
computers | readonly boolean[] | |
seed | number | |
moves | readonly SpadesMove[] | |
deal | number | Which deal this is, from 0: the deal moves one seat round each time. |
phase | SpadesPhase | |
hands | string[][] | |
bids | (number | null)[] | Each seat's bid this deal, 0 for nil, or null while it has not bid. |
trick | SpadesPlay[] | The trick on the table, in the order it was played. |
lastTrick | { plays: SpadesPlay[]; winner: number; } | null | The trick before, and who took it. |
played | string[] | Every card played in a finished trick this deal. |
toPlay | number | null | Whose move it is; null once the game is over. |
spadesBroken | boolean | Whether a spade has been played on another suit (or led from a hand of nothing else) this deal. |
tricks | number[] | The tricks each seat has taken this deal. |
scores | [number, number] | Each partnership's score, before this deal: seats 0 and 2, then 1 and 3. |
bags | [number, number] | Each partnership's overtricks carried towards the next ten. |
dealScores | SpadesDealScore[] | Each finished deal, one row a deal. |
例
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { SpadesGame } from "@johnmorrisdotca/toranpu/spades";
const names = Array.from({ length: CARD_GAME_TABLES.spades.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("spades", { players: names, seed: 42 })!;
const value: SpadesGame = game;
console.log(value.phase);bidding出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。