HeartsView型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What the seat to move can see: its own hand and the table.
インポート
import type { HeartsView } from "@johnmorrisdotca/toranpu/hearts";
定義
type HeartsView = {
seat: number;
seats: number;
hand: readonly CardId[];
phase: HeartsGame["phase"];
trick: readonly HeartsPlay[];
seen: ReadonlySet<CardId>;
playable: readonly CardId[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
seat | number | |
seats | number | |
hand | readonly string[] | |
phase | HeartsPhase | |
trick | readonly HeartsPlay[] | |
seen | ReadonlySet<string> | Every card already played this deal, finished tricks and the one on the table. |
playable | readonly string[] |
例
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { HeartsView } from "@johnmorrisdotca/toranpu/hearts";
import { heartsView } from "@johnmorrisdotca/toranpu/hearts";
const names = Array.from({ length: CARD_GAME_TABLES.hearts.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("hearts", { players: names, seed: 42 })!;
const value: HeartsView = heartsView(game);
console.log(value.hand.length);13出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。