本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · クロンダイク

KlondikeTable型

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

A game of Klondike as it stands: every pile, and the rules it is played under.

インポート

import type { KlondikeTable } from "@johnmorrisdotca/toranpu/klondike";

定義

type KlondikeTable = {
    rules: KlondikeRules;
    tableau: readonly KlondikeColumn[];
    stock: readonly number[];
    waste: readonly number[];
    foundation: readonly number[];
    recycles: number;
};

メンバー

名前型説明
rulesKlondikeRules
tableaureadonly KlondikeColumn[]

Seven columns.

stockreadonly number[]

Face down; the top card, the next to turn, is the LAST.

wastereadonly number[]

Face up beside the stock; the top card, the one that can be played, is the LAST.

foundationreadonly number[]

How many cards are home on each suit's foundation, in SUITS order: its top card is that rank.

recyclesnumber

How many times the waste has been turned back into the stock.

例

import { dealKlondike, dealOfSeed, deckOf } from "@johnmorrisdotca/toranpu/klondike";
import type { KlondikeTable } from "@johnmorrisdotca/toranpu/klondike";

const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 });
const value: KlondikeTable = table;
console.log(value.stock.length);
24

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

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

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