rulesForfunction
A game's rules by its kind, with its own game and move types.
Import it
import { rulesFor } from "@johnmorrisdotca/toranpu";
Definition
function rulesFor<K extends CardGameKind>(kind: K): CardGameRules<GameOf<K>, MoveOf<K>>
Parameters
| Name | Type | Description |
|---|---|---|
kind | K | The named card game or sound kind. |
Returns
CardGameRules<GameOf<K>, MoveOf<K>>
A game's rules by its kind, with its own game and move types.
Examples
import { newGame, rulesFor } from "@johnmorrisdotca/toranpu";
const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(rulesFor("hearts").moves(game).length);286What it prints (run when this page was built)