decodeEuchrefunction
Text read back into the game of Euchre it records, by playing every move again through the rules; null for anything they cannot play out.
Import it
import { decodeEuchre } from "@johnmorrisdotca/toranpu/euchre";
Definition
function decodeEuchre(text: string | null): EuchreGame | null
Parameters
| Name | Type | Description |
|---|---|---|
text | string | null | The notation, encoded state or saved text to read. |
Returns
EuchreGame | null
Text read back into the game of Euchre it records, by playing every move again through the rules; null for anything they cannot play out.
Examples
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { decodeEuchre, encodeEuchre } from "@johnmorrisdotca/toranpu/euchre";
const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("euchre", { players: names, seed: 42 })!;
console.log(decodeEuchre(encodeEuchre(game))?.phase);orderWhat it prints (run when this page was built)