本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · 大富豪

PresidentGame型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

A GAME OF PRESIDENT: its table and moves (what is kept), and the round they have reached. size is how many rounds the game lasts: 3, 5 or 7.

インポート

import type { PresidentGame } from "@johnmorrisdotca/toranpu/president";

定義

type PresidentGame = KeptCardGame<PresidentMove> & ClimbTrick & {
    round: number;
    phase: "exchange" | "playing" | "over";
    out: number[];
    titles: number[] | null;
    owed: {
        from: number;
        to: number;
        count: number;
    }[];
    swaps: PresidentSwap[];
    scores: number[];
    rounds: number[][];
};

メンバー

名前型説明
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
movesreadonly PresidentMove[]
handsstring[][]
pileClimbPlay | null

The cards to beat, or null when the seat to play leads.

passedboolean[]

Who has passed on this trick: they wait until it is cleared.

toPlaynumber | null

Whose move it is; null once the game is over.

playedstring[]

Every card played this deal, in order: what the whole table has seen.

roundnumber

Which round this is, from 0.

phase"playing" | "over" | "exchange"

Handing cards over before the round, playing it, or the game over.

outnumber[]

The order players went out this round, first to last so far.

titlesnumber[] | null

The order they went out last round, which gives this round's titles; null in the first.

owed{ from: number; to: number; count: number; }[]

The hands-back still owed this round, in order: who gives, to whom, how many.

swapsPresidentSwap[]

What has changed hands this round, both ways.

scoresnumber[]

Each seat's points so far: the most wins.

roundsnumber[][]

Each finished round's finishing order, first out first.

例

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { PresidentGame } from "@johnmorrisdotca/toranpu/president";

const names = Array.from({ length: CARD_GAME_TABLES.president.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("president", { players: names, seed: 42 })!;
const value: PresidentGame = game;
console.log(value.phase);
playing

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

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

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