decodeBigTwofunction
Text read back into the game of Big Two it records, by playing every move again through the rules; null for anything they cannot play out.
Import it
import { decodeBigTwo } from "@johnmorrisdotca/toranpu/big-two";
Definition
function decodeBigTwo(text: string | null): BigTwoGame | null
Parameters
| Name | Type | Description |
|---|---|---|
text | string | null | The notation, encoded state or saved text to read. |
Returns
BigTwoGame | null
Text read back into the game of Big Two 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 { decodeBigTwo, encodeBigTwo } from "@johnmorrisdotca/toranpu/big-two";
const names = Array.from({ length: CARD_GAME_TABLES.bigTwo.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("bigTwo", { players: names, seed: 42 })!;
console.log(decodeBigTwo(encodeBigTwo(game))?.phase);playingWhat it prints (run when this page was built)