本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · ジンラミー

GinGame型

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

A GAME OF GIN RUMMY: its table and moves (what is kept), and the hand they have reached. Two seats. size is the score that wins: 50, 100 or 150.

インポート

import type { GinGame } from "@johnmorrisdotca/toranpu/gin-rummy";

定義

type GinGame = KeptCardGame<GinMove> & {
    hand: number;
    phase: "draw" | "discard" | "over";
    hands: CardId[][];
    stock: CardId[];
    discard: CardId[];
    taken: CardId | null;
    toPlay: number | null;
    picked: CardId[][];
    throws: number;
    scores: number[];
    results: GinResult[];
};

メンバー

名前型説明
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
movesreadonly GinMove[]
handnumber

Which hand this is, from 0: the first to play alternates.

phase"over" | "discard" | "draw"

Drawing a card, throwing one, or the game over.

handsstring[][]
stockstring[]

The stock, face down, top card first.

discardstring[]

The discard pile, face up, the top card last.

takenstring | null

The card just taken from the discard pile, which may not be thrown straight back; null otherwise.

toPlaynumber | null
pickedstring[][]

The cards each seat has taken from the discard pile this hand and still holds: what the whole table watched them take.

throwsnumber

The cards thrown this hand so far: a new hand shows how the last was laid down until each player has thrown once.

scoresnumber[]
resultsGinResult[]

例

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { GinGame } from "@johnmorrisdotca/toranpu/gin-rummy";

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

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

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

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