本文へ移動

Toranpuトランプ

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

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

目次

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

replaceCard関数

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

A hand with one card tossed out and another given in its stead, at the front or the end: as a new list. Unchanged where it holds no such card.

インポート

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

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

定義

function replaceCard(cards: readonly string[], card: string, next: string, lands?: CardLands): string[]

引数

名前型説明
cardsreadonly string[]

The cards in their current order.

cardstring

The physical card or card id to read, draw or play.

nextstring

The replacement card or next state.

lands (省略可)CardLands

Where a replacement card is placed in the hand.

戻り値

string[]

A hand with one card tossed out and another given in its stead, at the front or the end: as a new list. Unchanged where it holds no such card.

例

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

console.log(replaceCard(["AS", "KH"], "AS", "2D"));
[ 'KH', '2D' ]

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

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

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