本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · ハーツ

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

メンバー

名前型説明
seatnumber
seatsnumber
handreadonly string[]
phaseHeartsPhase
trickreadonly HeartsPlay[]
seenReadonlySet<string>

Every card already played this deal, finished tricks and the one on the table.

playablereadonly 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

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

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

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