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

Euchre

import { … } from "@johnmorrisdotca/toranpu/euchre";

3.8 kB minified and gzipped, with everything it imports (measured with esbuild)

Euchre: its rules, its computer player and its saved-game format.

Exports

NameKindWhat it is
dealerOffunctionThe seat that deals this hand: the first seat, then round to the left.
decodeEuchrefunctionText read back into the game of Euchre it records, by playing every move again through the rules; null for anything they cannot play out.
encodeEuchrefunctionA game of Euchre as text: its table, its seed and its moves, never a hand.
EUCHRE_DECKconstantThe cards Euchre is played with: nine to ace of each suit.
EUCHRE_RULESconstantEuchre as one CardGameRules: everything a table asks of the game.
EUCHRE_SEATSconstantHow many play Euchre: four, in two partnerships.
euchreComputerfunctionThe move a computer in the seat to play makes: always one the rules allow.
EuchreGametypeA GAME OF EUCHRE: its table and moves (what is kept, KeptCardGame), and everything the moves make.
EuchreHandScoretypeWhat one hand did: which partnership made trumps, the tricks it took, and the points each partnership scored.
euchreHeightfunctionA card's height within its suit as the hand is played: ace high; in trumps the right bower, then the left, above everything.
EuchreMovetypeOrdering up the card turned up, or passing; naming another suit, or passing; the dealer throwing a card after picking the turned one up; or a card played to the trick.
euchreMovesfunctionEvery move the seat to play may make now; none once the game is over.
EuchrePhasetypeThe first round of the making (take the turned card's suit, or pass), the second (name another suit, or pass — the dealer may not), the dealer's discard, the tricks, or the game over.
EuchrePlaytypeOne card laid, and whose it was.
euchrePlayablefunctionThe cards the seat to play may lay on the trick: the suit led (the left bower counting as a trump) if it holds any.
euchreTrickWinnerfunctionWho is taking a trick: the highest trump, or else the highest card of the suit led.
euchreViewfunctionThe part of the game the seat to play can see, which is all its computer is given.
EuchreViewtypeA COMPUTER AT THE EUCHRE TABLE.
euchreWinnersfunctionThe partnership with the higher score wins, both its seats.
handPointsfunctionWhat a hand scores: one to the makers for three or four tricks, two for all five, and two to the other side when the makers take two or fewer.
partnerOffunctionThe seat across the table.
playEuchrefunctionThe game after that move, with the move added to its record, or null for a move the rules refuse.
sameColourfunctionThe suit of the same colour: clubs and spades, diamonds and hearts.
sortEuchrefunctionA hand sorted as a player holds it: by suit (trumps last once made), high cards to the right.
startEuchrefunctionA new game of Euchre for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Euchre is not offered for.
suitInfunctionThe suit a card belongs to once trumps are made: the left bower is a trump.
teamOffunctionA seat's partnership: 0 for seats 0 and 2, 1 for seats 1 and 3.
throwAwayfunctionAfter picking the turned card up: the lowest card outside trumps, from the shortest suit, never an ace.
trumpWorthfunctionHow much a hand is worth with this suit as trumps, roughly in tricks.

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