Reference
Go Fish
import { … } from "@johnmorrisdotca/toranpu/go-fish";
2.9 kB minified and gzipped, with everything it imports (measured with esbuild)
Go Fish: its rules, its computer player and its saved-game format.
Exports
| Name | Kind | What it is |
|---|---|---|
decodeGoFish | function | 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. |
encodeGoFish | function | A game of Go Fish as text: its table, its seed and its moves, never a hand. |
GO_FISH_RULES | constant | Go Fish as one CardGameRules: everything a table asks of the game. |
goFishComputer | function | The move a computer in the seat to play makes: always one the rules allow. |
GoFishEvent | type | What the whole table saw of a turn: who asked whom for what, how many cards were handed over, and — when none were — whether the card drawn from the pond was the rank asked for (which is shown, and earns another ask). |
GoFishGame | type | A GAME OF GO FISH: its table and moves (what is kept), and what they make. |
goFishHandSize | function | Seven cards each for two or three players, five for more. |
goFishMemory | function | What the table's log says about every seat's hand, worked out from the asks, the answers and the books. |
GoFishMemory | type | What the table has said about each seat's hand: for each seat, the ranks it is known to hold and known to be without. |
GoFishMove | type | Asking one player for every card they hold of one rank. |
goFishMoves | function | Every move the seat to play may make now; none once the game is over. |
goFishRanks | function | The ranks the seat to move may ask for: those it holds. |
goFishTargets | function | The players the seat to move may ask: everybody else holding cards, or, when nobody else does, anybody else. |
goFishView | function | The part of the game the seat to play can see, which is all its computer is given. |
GoFishView | type | What one seat can see of a game of Go Fish: its own hand, the table, and what has been said and shown. |
goFishWinners | function | The most books wins; level on the most shares it. |
playGoFish | function | The game after that move, with the move added to its record, or null for a move the rules refuse. |
sortGoFish | function | A hand as a player holds it: grouped by rank, ace to king. |
startGoFish | function | A new game of Go Fish for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Go Fish is not offered for. |