本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · ウォー

WarGame型

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

A GAME OF WAR: its table and moves (what is kept), and what they make. size is how many turns it may last, and hands are each player's cards, face down, the top card first. Nothing here is hidden: no player chooses anything.

インポート

import type { WarGame } from "@johnmorrisdotca/toranpu/war";

定義

type WarGame = KeptCardGame<WarMove> & {
    phase: "playing" | "over";
    hands: CardId[][];
    toPlay: number | null;
    last: WarTurn | null;
    ended: WarEnd | null;
};

メンバー

名前型説明
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
movesreadonly WarMove[]
phase"playing" | "over"
handsstring[][]

Each player's pile, top card first.

toPlaynumber | null

The seat the table waits on: the first person's, or the first seat when computers hold both. Null once over.

lastWarTurn | null

The last turn, for the table to show; null before the first.

endedWarEnd | null

Why the game ended; null while it goes on.

例

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { WarGame } from "@johnmorrisdotca/toranpu/war";

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

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

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

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