Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

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

NameKindWhat it is
decodeGoFishfunctionText 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.
encodeGoFishfunctionA game of Go Fish as text: its table, its seed and its moves, never a hand.
GO_FISH_RULESconstantGo Fish as one CardGameRules: everything a table asks of the game.
goFishComputerfunctionThe move a computer in the seat to play makes: always one the rules allow.
GoFishEventtypeWhat 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).
GoFishGametypeA GAME OF GO FISH: its table and moves (what is kept), and what they make.
goFishHandSizefunctionSeven cards each for two or three players, five for more.
goFishMemoryfunctionWhat the table's log says about every seat's hand, worked out from the asks, the answers and the books.
GoFishMemorytypeWhat the table has said about each seat's hand: for each seat, the ranks it is known to hold and known to be without.
GoFishMovetypeAsking one player for every card they hold of one rank.
goFishMovesfunctionEvery move the seat to play may make now; none once the game is over.
goFishRanksfunctionThe ranks the seat to move may ask for: those it holds.
goFishTargetsfunctionThe players the seat to move may ask: everybody else holding cards, or, when nobody else does, anybody else.
goFishViewfunctionThe part of the game the seat to play can see, which is all its computer is given.
GoFishViewtypeWhat one seat can see of a game of Go Fish: its own hand, the table, and what has been said and shown.
goFishWinnersfunctionThe most books wins; level on the most shares it.
playGoFishfunctionThe game after that move, with the move added to its record, or null for a move the rules refuse.
sortGoFishfunctionA hand as a player holds it: grouped by rank, ace to king.
startGoFishfunctionA 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.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.