toTextfunction
A game as a record a person can read: a heading, a numbered line a move with who made it, and how it stands. In English unless said.
It names every card, the ones passed face down too. It is a record for afterwards, not something to show a player while the game is on.
Import it
import { toText } from "@johnmorrisdotca/toranpu";
Definition
function toText<K extends CardGameKind>(kind: K, game: GameOf<K>, language?: Language): string
Parameters
| Name | Type | Description |
|---|---|---|
kind | K | The named card game or sound kind. |
game | GameOf<K> | The current native game; applying a move returns a new state. |
language (optional) | Language | English or Japanese for the displayed words. |
Returns
string
A game as a record a person can read: a heading, a numbered line a move with who made it, and how it stands. In English unless said. It names every card, the ones passed face down too. It is a record for afterwards, not something to show a player while the game is on.
Examples
import { newGame, toText } from "@johnmorrisdotca/toranpu";
const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(toText("hearts", game));Hearts for 4, seed 42: Aki, Ben, Cy, Dev
Not over. Aki to play.What it prints (run when this page was built)