newGamefunction
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 it
import { newGame } from "@johnmorrisdotca/toranpu";
Definition
function newGame<K extends CardGameKind>(kind: K, options: NewGameOptions): GameOf<K> | null
Parameters
| Name | Type | Description |
|---|---|---|
kind | K | The named card game or sound kind. |
options | NewGameOptions | Options for this call; omitted fields retain their documented defaults. |
Returns
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] });
Examples
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 ]What it prints (run when this page was built)