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
引数
| 名前 | 型 | 説明 |
|---|---|---|
kind | K | The named card game or sound kind. |
options | NewGameOptions | 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 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。