本文へ移動

Toranpuトランプ

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

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

目次

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

newGame関数

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

A new game of that kind, or null when the game is not offered for that table (too many players, or a size it does not play to).

const game = newGame("hearts", { players: ["You", "Ann", "Ben", "Cy"], computers: [false, true, true, true] });

インポート

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

定義

function newGame<K extends CardGameKind>(kind: K, options: NewGameOptions): GameOf<K> | null

引数

名前型説明
kindK

The named card game or sound kind.

optionsNewGameOptions

Options for this call; omitted fields retain their documented defaults.

戻り値

GameOf<K> | null

A new game of that kind, or null when the game is not offered for that table (too many players, or a size it does not play to). ts const game = newGame("hearts", { players: ["You", "Ann", "Ben", "Cy"], computers: [false, true, true, true] });

例

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

console.log(newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })?.hands.map((hand) => hand.length));
[ 13, 13, 13, 13 ]

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

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

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