encodeGoFishfunction
A game of Go Fish as text: its table, its seed and its moves, never a hand.
Import it
import { encodeGoFish } from "@johnmorrisdotca/toranpu/go-fish";
Definition
function encodeGoFish(game: GoFishGame): string
Parameters
| Name | Type | Description |
|---|---|---|
game | GoFishGame | The current native game; applying a move returns a new state. |
Returns
string
A game of Go Fish as text: its table, its seed and its moves, never a hand.
Examples
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { 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(encodeGoFish(game));{"v":1,"g":"goFish","size":1,"players":["Seat 1","Seat 2","Seat 3"],"computers":[false,false,false],"seed":42,"moves":[]}What it prints (run when this page was built)