本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · クリベッジ

CribbageGame型

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

A GAME OF CRIBBAGE: its table and moves (what is kept, KeptCardGame), and everything the moves make, read again from them whenever the game is. Two seats; size is the score that wins, 61 or 121.

インポート

import type { CribbageGame } from "@johnmorrisdotca/toranpu/cribbage";

定義

type CribbageGame = KeptCardGame<CribbageMove> & {
    deal: number;
    phase: CribbagePhase;
    hands: CardId[][];
    kept: CardId[][];
    crib: CardId[];
    cut: CardId;
    starter: CardId | null;
    count: number;
    run: CribbagePlay[];
    pegged: CribbagePlay[];
    peg: CribbagePeg | null;
    toPlay: number | null;
    scores: [
        number,
        number
    ];
    results: CribbageHandScore[];
};

メンバー

名前型説明
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
movesreadonly CribbageMove[]
dealnumber

Which hand this is, from 0: the deal goes to the other player each time.

phaseCribbagePhase
handsstring[][]

The cards each seat still holds: six dealt, four kept, then played away in the pegging.

keptstring[][]

The four cards each seat kept, as they will be shown.

cribstring[]
cutstring

The card to be cut once the crib is laid: face down until then, so never shown.

starterstring | null

The starter, once cut.

countnumber

The pegging count, 0 to 31.

runCribbagePlay[]

The cards played since the count last went back to nought.

peggedCribbagePlay[]

Every card played in the pegging this hand.

pegCribbagePeg | null

What the last card played scored, if it scored.

toPlaynumber | null
scores[number, number]
resultsCribbageHandScore[]

Each hand shown, one row a hand.

例

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { CribbageGame } from "@johnmorrisdotca/toranpu/cribbage";

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

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

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

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