moveTextfunction
A move in words, for any of the eleven games: moveText("hearts", { play: "QS" })
is "Play Q♠", and with { form: "did" } it is "plays Q♠". kind is needed
because a bid of nought is "nil" in Spades and "0" in Oh Hell.
Import it
import { moveText } from "@johnmorrisdotca/toranpu";
Definition
function moveText<K extends CardGameKind>(kind: K, move: MoveOf<K>, options?: MoveTextOptions): string
Parameters
| Name | Type | Description |
|---|---|---|
kind | K | The named card game or sound kind. |
move | MoveOf<K> | The native move to validate or apply. |
options (optional) | MoveTextOptions | Options for this call; omitted fields retain their documented defaults. |
Returns
string
A move in words, for any of the eleven games: moveText("hearts", { play: "QS" }) is "Play Q♠", and with { form: "did" } it is "plays Q♠". kind is needed because a bid of nought is "nil" in Spades and "0" in Oh Hell.
Examples
import { moveText, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(moveText("hearts", rulesFor("hearts").moves(game)[0]!, { language: "en" }));Pass 2♣ 3♣ 7♣What it prints (run when this page was built)