本文へ移動

Toranpuトランプ

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

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

目次

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

CribbageView型

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

A COMPUTER AT THE CRIBBAGE TABLE. Laying away, it tries every two cards it could throw and keeps the four whose show is worth most on average over every starter it might be cut, adding what the two thrown are worth to its own crib or taking it off the other player's. Pegging, it takes the most points a card can make now, and otherwise keeps the count off five and twenty-one (a ten makes fifteen or thirty-one of them), leads low, and never leads a five.

It reads a view of the game (cribbageView): its own hand and what is on the table — nothing of the other hand, the crib, or the card to be cut.

インポート

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

定義

type CribbageView = {
    seat: number;
    dealer: number;
    phase: CribbageGame["phase"];
    hand: readonly CardId[];
    count: number;
    run: readonly CardId[];
};

メンバー

名前型説明
seatnumber
dealernumber
phaseCribbagePhase
handreadonly string[]
countnumber
runreadonly string[]

例

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { CribbageView } from "@johnmorrisdotca/toranpu/cribbage";
import { cribbageView } 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: CribbageView = cribbageView(game);
console.log(value.hand.length);
6

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

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

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