本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · クレイジーエイツ

CrazyEightsGame型

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

A GAME OF CRAZY EIGHTS: its table and moves (what is kept), and the hand they have reached. size is the score that wins: 50, 100 or 200.

インポート

import type { CrazyEightsGame } from "@johnmorrisdotca/toranpu/crazy-eights";

定義

type CrazyEightsGame = KeptCardGame<CrazyEightsMove> & {
    hand: number;
    phase: "playing" | "over";
    hands: CardId[][];
    stock: CardId[];
    discard: CardId[];
    suit: CardSuit;
    toPlay: number | null;
    drawn: CardId | null;
    passes: number;
    turnovers: number;
    scores: number[];
    results: CrazyEightsResult[];
};

メンバー

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

Which hand this is, from 0: it decides who plays first, round the table.

phase"playing" | "over"
handsstring[][]
stockstring[]

The stock, face down, top card first.

discardstring[]

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

suitCardSuit

The suit to follow: the top card's, or the one called when an eight was played.

toPlaynumber | null
drawnstring | null

The card the player to move has just drawn, the only one they may now play; null before they draw.

passesnumber

Turns passed in a row with nothing to draw: when every player has, the hand is blocked.

turnoversnumber

How many times the discards have been shuffled into a new stock this hand.

scoresnumber[]

Each seat's points so far: the first to the game's size wins.

resultsCrazyEightsResult[]

例

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { CrazyEightsGame } from "@johnmorrisdotca/toranpu/crazy-eights";

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

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

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

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