本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · カード・手札・山札

mixCards関数

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

A hand mixed up, as a new list: the same cards in another order, never the order given (where a hand has two cards or more that differ), so a mix is always seen to change something. random is any source of numbers in [0, 1); unless given, Math.random.

インポート

import { mixCards } from "@johnmorrisdotca/toranpu/element";

ほかのエクスポート元: @johnmorrisdotca/toranpu/element/define

定義

function mixCards(cards: readonly string[], random?: () => number): string[]

引数

名前型説明
cardsreadonly string[]

The cards in their current order.

random (省略可)() => number

A source of numbers in [0, 1), such as seededRandom(seed).

戻り値

string[]

A hand mixed up, as a new list: the same cards in another order, never the order given (where a hand has two cards or more that differ), so a mix is always seen to change something. random is any source of numbers in [0, 1); unless given, Math.random.

例

import { mixCards } from "@johnmorrisdotca/toranpu/element";
import { seededRandom } from "@johnmorrisdotca/toranpu/deck";

console.log(mixCards(["AS", "KH", "TD"], seededRandom(42)));
[ 'TD', 'AS', 'KH' ]

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

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

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