EuchreView型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A COMPUTER AT THE EUCHRE TABLE. Making trumps, it weighs its hand in each suit — the bowers, the trump ace and king, the aces outside and the suits it is short in — and orders up or names a suit only with a hand that should take three tricks with its partner's help, counting the turned card for its own side when it or its partner deals. Stuck as dealer, it names its best. Playing, it leads its best trump when its side made them, cashes aces, leaves a trick its partner has won alone, and takes a trick as cheaply as it can.
It reads a view of the game (euchreView): its own hand, the card turned
up, the making so far and the cards played — nothing of another hand.
インポート
import type { EuchreView } from "@johnmorrisdotca/toranpu/euchre";
定義
type EuchreView = {
seat: number;
dealer: number;
hand: readonly CardId[];
phase: EuchreGame["phase"];
upcard: CardId;
trump: CardSuit | null;
maker: number | null;
trick: readonly EuchrePlay[];
tricks: readonly number[];
seen: ReadonlySet<CardId>;
playable: readonly CardId[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
seat | number | |
dealer | number | |
hand | readonly string[] | |
phase | EuchrePhase | |
upcard | string | |
trump | CardSuit | null | |
maker | number | null | |
trick | readonly EuchrePlay[] | |
tricks | readonly number[] | |
seen | ReadonlySet<string> | |
playable | readonly string[] |
例
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { EuchreView } from "@johnmorrisdotca/toranpu/euchre";
import { euchreView } from "@johnmorrisdotca/toranpu/euchre";
const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("euchre", { players: names, seed: 42 })!;
const value: EuchreView = euchreView(game);
console.log(value.hand.length);5出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。