本文へ移動

Toranpuトランプ

デッキを使い、11種類のゲームでコンピューターと対戦し、ソリティアを解いたり、独自の絵柄でカードを表示したりできます。

「トランプ」は、日本語で playing cards を指す言葉です。 名前について(英語)

目次

リファレンス · ユーカー

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[];
};

メンバー

名前型説明
seatnumber
dealernumber
handreadonly string[]
phaseEuchrePhase
upcardstring
trumpCardSuit | null
makernumber | null
trickreadonly EuchrePlay[]
tricksreadonly number[]
seenReadonlySet<string>
playablereadonly 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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/toranpu 2.15.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。