本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · ゲームと状態

dealRound関数

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

Deals the cards one at a time round the table, from the first seat, as a dealer does: each to a seat, or every card when each is absent (so some seats hold one more than others). What is not dealt is the stock, in order, its top card first.

インポート

import { dealRound } from "@johnmorrisdotca/toranpu";

定義

function dealRound(deck: readonly CardId[], seats: number, each?: number): { hands: CardId[][]; stock: CardId[]; }

引数

名前型説明
deckreadonly string[]

The deck in its current order; the input is left unchanged.

seatsnumber

The seat count or seat state supplied by this API.

each (省略可)number | undefined

The number of cards dealt to each hand.

戻り値

{ hands: CardId[][]; stock: CardId[]; }

Deals the cards one at a time round the table, from the first seat, as a dealer does: each to a seat, or every card when each is absent (so some seats hold one more than others). What is not dealt is the stock, in order, its top card first.

例

import { FULL_DECK, dealRound } from "@johnmorrisdotca/toranpu";

console.log(dealRound(FULL_DECK, 4, 5).hands.map((hand) => hand.length));
[ 5, 5, 5, 5 ]

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

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

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