本文へ移動

Toranpuトランプ

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

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

目次

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

shuffledDeck関数

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

The deck shuffled for one deal of one game: the same seed and deal always the same order, so a game kept as its seed and moves deals itself again exactly, and reloading can never re-deal a hand somebody has seen.

インポート

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

定義

function shuffledDeck(seed: number, deal: number, leaveOut?: readonly CardId[]): CardId[]

引数

名前型説明
seednumber

The numeric seed that reproduces the same shuffle or deal.

dealnumber

The deal number or dealing specification.

leaveOut (省略可)readonly string[]

Cards to omit from the generated deck or possibilities.

戻り値

string[]

The deck shuffled for one deal of one game: the same seed and deal always the same order, so a game kept as its seed and moves deals itself again exactly, and reloading can never re-deal a hand somebody has seen.

例

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

console.log(shuffledDeck(42, 0).slice(0, 7));
[
  'KC', '9S',
  '4C', '5D',
  'QS', 'AD',
  '4H'
]

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

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

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