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