Skip to the content

Toranpu documentation

Toranpu API: every export

Every export of every entry point, each with its own page. This page keeps the addresses the old one-page reference had.

@johnmorrisdotca/toranpu/deck

Cardtype

A card as an object: its suit and its rank.

CARD_ALPHABETconstant

The fifty-two characters a card is written as, in deck order: spades A–K are A–M, hearts N–Z, diamonds a–m, clubs n–z.

cardAtfunction

The card at a place in a fresh deck, 0 to 51.

cardCodefunction

One character for a card (CARD_ALPHABET).

CardCodetype

A card as ONE character, A–Z then a–z (cardCode): a whole deck is a fifty-two-character string, so a deal travels in a saved game, an address and a move list without any separator to parse.

cardFromCodefunction

The card a character names, or null for one that names none — a kept string is read, never trusted.

cardFromIdfunction

The card a two-character id names, or null.

cardIdfunction

"QS", "TH", "AC": the two-character id card players write, rank then suit, with T for the ten.

cardIndexfunction

The card's place in a fresh deck, 0 to 51.

cardNamefunction

"queen of hearts": the name a screen reader says.

colourOffunction

A card's colour: red for hearts and diamonds, black for spades and clubs.

dealAllfunction

Deal the whole deck round the table: the first hands get one more where it does not divide evenly.

dealRoundfunction

Deal one card at a time round the table, as a dealer does: hands hands of each cards, dealt from the top (the start of the array), and what is left.

DECK_SIZEconstant

How many cards a deck holds: fifty-two.

freshDeckfunction

A fresh deck in the order a new pack is sorted: spades ace to king, then hearts, diamonds, clubs.

isRedfunction

Whether a card is a heart or a diamond.

isWholeDeckfunction

Whether a string is a whole deck: fifty-two cards, each exactly once.

Randomtype

A number in [0, 1), like Math.random, from a stream a seed fixes.

Ranktype

Ace is 1 and King 13.

RANK_DISPLAYconstant

How each rank is written: short (A, 10, K) and as a word (ace, ten, king).

RankDisplaytype

How a rank is written: A, 2…10, J, Q, K, and in a sentence.

RANKSconstant

The ranks in order, ace low: 1 (the ace) to 13 (the king).

readCardsfunction

A string of card characters read back, or null if any character names no card.

sameCardfunction

Whether two card objects are the same card.

seededRandomfunction

A stream of numbers in [0, 1) fixed by a seed.

shuffledfunction

A copy of the list in a random order (Fisher–Yates); the list given is left alone.

shuffledDeckfunction

A deck shuffled from a seed: the same seed, the same order, in every browser and every test.

sortedHandfunction

A hand sorted by suit (the fresh-deck order) and then by rank: how a player arranges one.

Suittype

One of the four suits, by name.

SUIT_DISPLAYconstant

How each suit is written and drawn: its symbol, its name and its colour.

SuitColourtype

A suit's colour, which Klondike's alternating runs and Crazy Eights' matches both read.

SUITSconstant

The suits in the order a fresh deck is sorted and a foundation row is laid out: spades, hearts, diamonds, clubs — black, red, red, black, so no two neighbours on a row of four look alike.

takefunction

Take count from the top: what was taken, and what is left.

writeCardsfunction

A run of cards as a string, one character each.

@johnmorrisdotca/toranpu/react

CardGameStatetype

A card game in React state: the game, the moves the person to play may make, and play to make one.

@johnmorrisdotca/toranpu/card-sounds

CardSoundDatatype

The recordings, by name (deal-2), as base64 AAC.

CardSoundKindtype

One kind of sound: deal a card sent to a hand, flip a card turned over, play a card laid on the table, shuffle the deck shuffled, gather a pile swept in, fan a hand spread open.

CardSoundstype

A table's sounds: play one, mute and unmute, change the volume, close when the table goes.

CardSoundWindowtype

The parts of a window the sounds use: an audio context and atob.

MOST_SOUNDS_AT_ONCEconstant

As many sounds as one call plays: thirteen cards dealt are eight slides, not a wall of noise.

soundTimesfunction

When each of count sounds starts, in milliseconds from the first: one every gap, and no more than MOST_SOUNDS_AT_ONCE, spread over the same time.

@johnmorrisdotca/toranpu/sounds

CARD_SOUND_DATAconstant

The card sounds, recorded: cards dealt, turned over, played, shuffled, gathered and fanned, as base64 AAC (.m4a).

CardSoundFiletype

The name of one recording: its kind of sound and a number, such as deal-2.

@johnmorrisdotca/toranpu/card-backs

CARD_BACK_LOOKconstant

Each back's own colours: its field, the lines and dots drawn on the field, and the paper round it.

CARD_BACK_PROPERTIESconstant

The CSS custom properties a back drawn into a page takes its colours from, when no colour is given.

CARD_BOXconstant

A card is drawn in a box 100 wide and 140 tall, the 5:7 of a poker-size card, and scales to any width.

cardBackNamesfunction

The backs a page may ask for by name: the package's own, and any the page registered (registerCardBack).

cardBackSvgfunction

A back as a whole SVG document, 100 by 140.

cardBackUrlfunction

A back as a data URL, for an <img src>, a CSS background or a canvas: the same drawing as cardBackSvg, with its own colours.

CardSuitLettertype

A suit as one letter, as a card's id writes it: spades, hearts, diamonds, clubs.

RegisteredCardBacktype

A back registered by name: how it is drawn, and the built-in back it starts from.

SUIT_PATHSconstant

The four suits, each a path in a box of 100 filled in one colour.

@johnmorrisdotca/toranpu/card-faces

CARD_FACE_PROPERTIESconstant

The CSS custom properties a plain or four-colour face drawn into a page takes its colours from.

CardDesigntype

A set of drawn cards: its name, the box each card is drawn in, and each card's drawing (what goes inside an <svg> of that box) by its id, KS for the king of spades and RJ and BJ for the red and black jokers.

cardFaceFromArtfunction

A card's face from artwork of your own: art is SVG markup (or a whole <svg> document) drawn on the card's paper in a box 100 by 140, or in box, fitted to the card's height and centred; a whole <svg> is used as it is.

cardFaceSvgfunction

A card's face as a whole SVG document, 100 by 140: QS, TD, a joker (RJ, BJ), a rules card (R1, R2) or the blank (BL).

cardFaceUrlfunction

A card's face as a data URL, for an <img src>, a CSS background or a canvas.

cleanMarkupfunction

SVG markup with what could run or fetch taken out: scripts, foreignObject, frames, animation elements and styles, every on… handler, and any href that is not a picture or a #fragment of the drawing itself.

CUSTOM_CARD_IDconstant

What a card's id may be, when a design of the page draws it: letters and digits, with -, _, . and : inside, up to 40.

EXTRA_CARDSconstant

THE EXTRAS OF A REAL DECK, which no game here deals but a hand on a page may hold, as a wild card or for the look of it: the two jokers, the two rules cards a pack is sold with (R1, the rules of Hearts; R2, of Spades), and a blank (BL).

EXTRA_LIMITSconstant

The most of each kind of extra one hand holds: four jokers, as some packs have; two rules cards; two blanks.

faceNamefunction

A face's name in words: "queen of spades", "red joker"; in Japanese "スペードのクイーン", "赤のジョーカー".

isCardFacefunction

Whether a text is a card a face can be drawn for: QS, TD, a joker (RJ, BJ), a rules card (R1, R2) or the blank (BL).

JOKERSconstant

The two jokers' ids: the red joker and the black.

loadCardDesignfunction

A design by its name, loaded when it is first asked for: "english" fetches the English pattern (about 700 kB, 200 kB compressed) only then.

pipPlacesfunction

The middles of a number card's pips, in the 100 by 140 box, and whether each is drawn upside down.

registerCardDesignfunction

Keep a design by its name, in place of any earlier one of that name.

safeImageUrlfunction

A picture's address, or null when it is anything else.

@johnmorrisdotca/toranpu/card-faces/english

ENGLISH_PATTERNconstant

The English pattern, every card and two jokers, drawn in a box 360 by 540.

@johnmorrisdotca/toranpu/card-faces/realistic

REALISTICconstant

The realistic design: Knoll's 39 cards in a box 167.0869141 by 242.6669922, and Fomin's English pattern for every other card.

@johnmorrisdotca/toranpu/element

arrangeCardsfunction

A hand laid out another way, as a new list (the one given is left alone): "rank" sorts it low to high, the ace high, a rank's cards in suit order; "suit" groups it by suit, spades, hearts, clubs, diamonds, each in rank order; "face" groups it into the number cards, ace to ten, and then the face cards, jack, queen, king, each group in rank order and a rank's cards in suit order; "dealt" keeps the order given.

BUNDLE_BACKSconstant

How many backs a squared-up bundle shows, whatever the hand: a bundle never tells how many cards are in it.

CardFaceContexttype

What a card's face function is told: the language the card speaks, and the design it names.

CardFaceRenderertype

A function that draws a card's face: given the card's id and its context, SVG markup (drawn on the card's paper in a box 100 by 140, or a whole <svg> document), or an element, or null to draw the card as its design does.

CardLandstype

Where a card a hand is given goes: to the front, or the end.

CardOrdertype

How a hand's cards are laid out: as they were dealt, by rank, grouped by suit, or the number cards apart from the face cards.

CardPlacetype

One card's place: across and down in card widths from where the first lies, and its turn in degrees.

defineHandfunction

Register a hand under its standard tag or a host-supplied tag.

defineToranpuElementsfunction

Register the elements under their tags, once; a tag already taken is left as it is.

ELEMENT_SIZESconstant

The sizes every element takes, as a card's width in pixels.

handLayoutfunction

Where each card of a hand of count lies: a fan when open, a squared-up stack with a sliver of each card showing when closed, and every shape in between.

mixCardsfunction

A hand mixed up, as a new list: the same cards in another order, never the order given (where a hand has two cards or more that differ), so a mix is always seen to change something.

partedHandLayoutfunction

A HAND PARTED AT ONE CARD: that card lifted a little, upright and wholly in view, and the cards to its left and right drawn apart from it into a group on each side (one group where it is the first or the last).

pileLayoutfunction

Where each card of a pile of count lies, bottom first, the top card last: at 0 messiness a neat stack whose edge shows a card's thickness for each card under the top, and towards 1 a heap, each card nudged and turned a little more.

readHandfunction

A hand written as text, as its cards: the two-letter ids separated by spaces or commas ("AS KH 10D TC RJ", with 10 for ten as well as T), or the deck's one-letter codes run together ("pvOZ").

registerCardDesignfunction

Keep a design by its name, in place of any earlier one of that name.

replaceCardfunction

A hand with one card tossed out and another given in its stead, at the front or the end: as a new list.

ToranpuCardclass

ONE CARD ON ANY PAGE: <toranpu-card card="QS">, in any design and with any back, face up or face down, turned over by a tap when it has flip.

ToranpuHandclass

A HAND OF CARDS ON ANY PAGE: <toranpu-hand cards="AS KH QD">, fanned, in any design and with any back.

ToranpuPileclass

A PILE OF CARDS ON ANY PAGE: <toranpu-pile>, a stock to draw from or a discard pile, its top card on top and the cards under it showing as a stack, from neatly squared to very messy.

tossCardfunction

A hand without one card, as a new list: the first of that card taken out, or the hand unchanged where it holds none.

@johnmorrisdotca/toranpu/element/define

arrangeCardsfunction

A hand laid out another way, as a new list (the one given is left alone): "rank" sorts it low to high, the ace high, a rank's cards in suit order; "suit" groups it by suit, spades, hearts, clubs, diamonds, each in rank order; "face" groups it into the number cards, ace to ten, and then the face cards, jack, queen, king, each group in rank order and a rank's cards in suit order; "dealt" keeps the order given.

BUNDLE_BACKSconstant

How many backs a squared-up bundle shows, whatever the hand: a bundle never tells how many cards are in it.

CardFaceContexttype

What a card's face function is told: the language the card speaks, and the design it names.

CardFaceRenderertype

A function that draws a card's face: given the card's id and its context, SVG markup (drawn on the card's paper in a box 100 by 140, or a whole <svg> document), or an element, or null to draw the card as its design does.

CardLandstype

Where a card a hand is given goes: to the front, or the end.

CardOrdertype

How a hand's cards are laid out: as they were dealt, by rank, grouped by suit, or the number cards apart from the face cards.

CardPlacetype

One card's place: across and down in card widths from where the first lies, and its turn in degrees.

defineHandfunction

Register a hand under its standard tag or a host-supplied tag.

defineToranpuElementsfunction

Register the elements under their tags, once; a tag already taken is left as it is.

ELEMENT_SIZESconstant

The sizes every element takes, as a card's width in pixels.

handLayoutfunction

Where each card of a hand of count lies: a fan when open, a squared-up stack with a sliver of each card showing when closed, and every shape in between.

mixCardsfunction

A hand mixed up, as a new list: the same cards in another order, never the order given (where a hand has two cards or more that differ), so a mix is always seen to change something.

partedHandLayoutfunction

A HAND PARTED AT ONE CARD: that card lifted a little, upright and wholly in view, and the cards to its left and right drawn apart from it into a group on each side (one group where it is the first or the last).

pileLayoutfunction

Where each card of a pile of count lies, bottom first, the top card last: at 0 messiness a neat stack whose edge shows a card's thickness for each card under the top, and towards 1 a heap, each card nudged and turned a little more.

readHandfunction

A hand written as text, as its cards: the two-letter ids separated by spaces or commas ("AS KH 10D TC RJ", with 10 for ten as well as T), or the deck's one-letter codes run together ("pvOZ").

registerCardDesignfunction

Keep a design by its name, in place of any earlier one of that name.

replaceCardfunction

A hand with one card tossed out and another given in its stead, at the front or the end: as a new list.

ToranpuCardclass

ONE CARD ON ANY PAGE: <toranpu-card card="QS">, in any design and with any back, face up or face down, turned over by a tap when it has flip.

ToranpuHandclass

A HAND OF CARDS ON ANY PAGE: <toranpu-hand cards="AS KH QD">, fanned, in any design and with any back.

ToranpuPileclass

A PILE OF CARDS ON ANY PAGE: <toranpu-pile>, a stock to draw from or a discard pile, its top card on top and the cards under it showing as a stack, from neatly squared to very messy.

tossCardfunction

A hand without one card, as a new list: the first of that card taken out, or the hand unchanged where it holds none.

@johnmorrisdotca/toranpu/table

defineToranpuTablefunction

Registers <toranpu-table>, and the card, hand and pile elements, once.

TABLE_CLOTHSconstant

THE CLOTHS A TABLE MAY BE LAID IN: the same five the whole family offers, and itsutsu.com's boards.

ToranpuTableclass

<toranpu-table>: ANY OF THE ELEVEN GAMES, READY TO PLAY.

@johnmorrisdotca/toranpu/table/define

defineToranpuTablefunction

Registers <toranpu-table>, and the card, hand and pile elements, once.

TABLE_CLOTHSconstant

THE CLOTHS A TABLE MAY BE LAID IN: the same five the whole family offers, and itsutsu.com's boards.

ToranpuTableclass

<toranpu-table>: ANY OF THE ELEVEN GAMES, READY TO PLAY.

@johnmorrisdotca/toranpu/hearts

choosePassfunction

The three cards a computer passes from a hand of Hearts: the queen of spades and the high spades that catch her, high hearts, and cards from a short suit.

decodeHeartsfunction

Text read back into the game of Hearts it records, by playing every move again through the rules; null for anything they cannot play out.

encodeHeartsfunction

A game of Hearts as text: its table, its seed and its moves, never a hand.

HEARTS_RULESconstant

Hearts as one CardGameRules: everything a table asks of the game.

heartsComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

HeartsGametype

A GAME OF HEARTS: its table and moves (what is kept, KeptCardGame), and everything the moves make, read again from them whenever the game is.

HeartsMovetype

Three cards passed (all three at once, as a player hands them over), or one card played to the trick.

heartsMovesfunction

Every move the seat to play may make now; none once the game is over.

HeartsPhasetype

Passing three cards before the deal is played, playing it out trick by trick, or the game over.

HeartsPlaytype

One card laid on a trick, and whose it was.

heartsPlayablefunction

The cards the seat to play may lay on the trick now.

heartsPointsfunction

A card's points: a heart one, the queen of spades thirteen.

heartsViewfunction

The part of the game the seat to play can see, which is all its computer is given.

HeartsViewtype

What the seat to move can see: its own hand and the table.

heartsWinnersfunction

The lowest score wins; level on the lowest shares it.

passOffsetfunction

How far round the table the cards go this deal: 1 to the left, seats − 1 to the right, 2 across, 0 held.

playHeartsfunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

QUEEN_OF_SPADESconstant

The queen of spades, worth thirteen points to whoever takes her.

sortHeartsfunction

A hand sorted as a player holds it: clubs, diamonds, spades, hearts, low to high within each.

startHeartsfunction

A new game of Hearts for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Hearts is not offered for.

trickWinnerfunction

Who takes a finished trick: the highest card of the suit led.

TWO_OF_CLUBSconstant

The two of clubs, which leads the first trick of every deal.

@johnmorrisdotca/toranpu/spades

chooseBidfunction

Nil for a hand of nothing (and never beside a partner's nil); otherwise what the hand is worth, at least one.

contractOffunction

A partnership's contract this deal: its bids added, a nil counting none; null while either has still to bid.

dealerOffunction

The seat that deals this deal: the first seat, then round to the left.

decodeSpadesfunction

Text read back into the game of Spades it records, by playing every move again through the rules; null for anything they cannot play out.

encodeSpadesfunction

A game of Spades as text: its table, its seed and its moves, never a hand.

handWorthfunction

The tricks a hand is worth, counted as a card player counts them before bidding.

NILconstant

The bid that means no tricks at all.

partnershipScorefunction

What one partnership made of a deal: its contract (the two bids, a nil counting none) made or not, each nil made or not, and the overtricks — the tricks over the contract, and any trick a nil bidder took — as bags.

playSpadesfunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

sortSpadesfunction

A hand sorted as a player holds it: diamonds, clubs, hearts, spades, low to high within each.

SPADES_BIDSconstant

The bids open to a player: nil, or one to thirteen tricks.

SPADES_RULESconstant

Spades as one CardGameRules: everything a table asks of the game.

SPADES_SEATSconstant

How many play Spades: four, in two partnerships.

spadesComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

SpadesDealScoretype

What one finished deal did to a partnership's score, as the scores table explains it.

SpadesGametype

A GAME OF SPADES: its table and moves (what is kept, KeptCardGame), and everything the moves make, read again from them whenever the game is.

SpadesMovetype

A bid of tricks, 0 (nil) to 13, or one card played to the trick.

spadesMovesfunction

Every move the seat to play may make now; none once the game is over.

SpadesPhasetype

Bidding how many tricks each seat will take, playing the deal out trick by trick, or the game over.

SpadesPlaytype

One card laid on a trick, and whose it was.

spadesPlayablefunction

The cards the seat to play may lay on the trick now.

spadesTrickWinnerfunction

Who takes a finished trick (or is winning one still being played): the highest spade, or else the highest card of the suit led.

spadesViewfunction

The part of the game the seat to play can see, which is all its computer is given.

SpadesViewtype

What the seat to move can see: its own hand, every bid, the tricks taken and the cards played.

spadesWinnersfunction

The partnership with the higher score wins, both its seats.

startSpadesfunction

A new game of Spades for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Spades is not offered for.

teamOffunction

A seat's partnership: 0 for seats 0 and 2, 1 for seats 1 and 3.

@johnmorrisdotca/toranpu/euchre

dealerOffunction

The seat that deals this hand: the first seat, then round to the left.

decodeEuchrefunction

Text read back into the game of Euchre it records, by playing every move again through the rules; null for anything they cannot play out.

encodeEuchrefunction

A game of Euchre as text: its table, its seed and its moves, never a hand.

EUCHRE_DECKconstant

The cards Euchre is played with: nine to ace of each suit.

EUCHRE_RULESconstant

Euchre as one CardGameRules: everything a table asks of the game.

EUCHRE_SEATSconstant

How many play Euchre: four, in two partnerships.

euchreComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

EuchreGametype

A GAME OF EUCHRE: its table and moves (what is kept, KeptCardGame), and everything the moves make.

EuchreHandScoretype

What one hand did: which partnership made trumps, the tricks it took, and the points each partnership scored.

euchreHeightfunction

A card's height within its suit as the hand is played: ace high; in trumps the right bower, then the left, above everything.

EuchreMovetype

Ordering 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.

euchreMovesfunction

Every move the seat to play may make now; none once the game is over.

EuchrePhasetype

The 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.

euchrePlayablefunction

The cards the seat to play may lay on the trick: the suit led (the left bower counting as a trump) if it holds any.

euchreTrickWinnerfunction

Who is taking a trick: the highest trump, or else the highest card of the suit led.

euchreViewfunction

The part of the game the seat to play can see, which is all its computer is given.

euchreWinnersfunction

The partnership with the higher score wins, both its seats.

handPointsfunction

What 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.

playEuchrefunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

sameColourfunction

The suit of the same colour: clubs and spades, diamonds and hearts.

sortEuchrefunction

A hand sorted as a player holds it: by suit (trumps last once made), high cards to the right.

startEuchrefunction

A 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.

suitInfunction

The suit a card belongs to once trumps are made: the left bower is a trump.

teamOffunction

A seat's partnership: 0 for seats 0 and 2, 1 for seats 1 and 3.

throwAwayfunction

After picking the turned card up: the lowest card outside trumps, from the shortest suit, never an ace.

trumpWorthfunction

How much a hand is worth with this suit as trumps, roughly in tricks.

@johnmorrisdotca/toranpu/cribbage

cardValuefunction

A card's worth in the count: ace one, court cards ten.

chooseCribfunction

The two cards to lay away: the four kept worth most on average with every starter, the crib counted for or against.

choosePegfunction

The card to peg: most points now, then a count kept off five and twenty-one, a low lead that is not a five.

CRIBBAGE_RULESconstant

Cribbage as one CardGameRules: everything a table asks of the game.

cribbageComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

CribbageGametype

A GAME OF CRIBBAGE: its table and moves (what is kept, KeptCardGame), and everything the moves make, read again from them whenever the game is.

CribbageHandScoretype

One hand as it was shown: the dealer, the starter, both four-card hands and the crib, and what each counted.

CribbageMovetype

Two cards laid away to the crib, or one card played in the pegging.

cribbageMovesfunction

Every move the seat to play may make now; none once the game is over.

CribbagePegtype

What one card played in the pegging scored, and why: "fifteen", "a pair", "a run of three", "go", "last card", "thirty-one".

CribbagePhasetype

Both players laying two cards to the crib, the pegging, or the game over.

cribbagePlayablefunction

The cards a seat may play on the count now: any that keeps it to thirty-one.

cribbageViewfunction

The part of the game the seat to play can see, which is all its computer is given.

cribPairsfunction

Every way to lay two of a hand away.

dealerOffunction

The seat that deals this hand: the first seat, then the other, turn about.

decodeCribbagefunction

Text read back into the game of Cribbage it records, by playing every move again through the rules; null for anything they cannot play out.

encodeCribbagefunction

A game of Cribbage as text: its table, its seed and its moves, never a hand.

otherOffunction

The seat that is not this one.

pegPointsfunction

What laying the last card of cards scores, the count now count: fifteen, thirty-one, pairs and runs.

playCribbagefunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

showCountfunction

What four cards and the starter are worth in the show.

sortCribbagefunction

A hand sorted as a player holds it: ace low to king, by rank then suit.

startCribbagefunction

A new game of Cribbage for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Cribbage is not offered for.

throwWorthfunction

What two cards thrown to a crib are worth to it, roughly: a pair, a fifteen, fives, and cards close enough to run.

@johnmorrisdotca/toranpu/oh-hell

chooseOhHellBidfunction

The bid nearest what the hand is worth, among those allowed.

dealerOffunction

The seat that deals this deal: the first seat, then round to the left.

dealPointsfunction

What a seat scores for a deal: ten and its bid for exactly what it bid, nothing otherwise.

dealSizesfunction

The cards dealt to each seat in each deal of a game of this length: up to seven, and back down in the long game.

decodeOhHellfunction

Text read back into the game of Oh Hell it records, by playing every move again through the rules; null for anything they cannot play out.

encodeOhHellfunction

A game of Oh Hell as text: its table, its seed and its moves, never a hand.

OH_HELL_RULESconstant

Oh Hell as one CardGameRules: everything a table asks of the game.

ohHellBidsfunction

The bids open to the seat to bid: nought to the cards in hand, less the one a dealer may not make.

ohHellComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

OhHellDealScoretype

What one finished deal did: each seat's bid, the tricks it took, and what it scored.

OhHellGametype

A GAME OF OH HELL: its table and moves (what is kept, KeptCardGame), and everything the moves make.

OhHellMovetype

A bid of tricks, nought up to the cards in hand, or one card played to the trick.

ohHellMovesfunction

Every move the seat to play may make now; none once the game is over.

OhHellPhasetype

Bidding the exact number of tricks each seat will take, playing the deal out, or the game over.

ohHellPlayablefunction

The cards the seat to play may lay: the suit led if it holds any.

ohHellTrickWinnerfunction

Who takes a trick: the highest trump, or else the highest card of the suit led.

ohHellViewfunction

The part of the game the seat to play can see, which is all its computer is given.

ohHellWinnersfunction

The highest score after the last deal: every seat that has it.

ohHellWorthfunction

The tricks a hand should take with these trumps, roughly.

playOhHellfunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

sortOhHellfunction

A hand as a player holds it: by suit, trumps last, high cards to the right.

startOhHellfunction

A new game of Oh Hell for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Oh Hell is not offered for.

@johnmorrisdotca/toranpu/crazy-eights

CRAZY_EIGHTS_RULESconstant

Crazy Eights as one CardGameRules: everything a table asks of the game.

crazyEightsComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

CrazyEightsGametype

A GAME OF CRAZY EIGHTS: its table and moves (what is kept), and the hand they have reached.

CrazyEightsMovetype

A card played (an eight names the suit to follow), a card drawn from the stock, or a turn passed.

crazyEightsMovesfunction

Every move the seat to play may make now; none once the game is over.

crazyEightsViewfunction

The part of the game the seat to play can see, which is all its computer is given.

CrazyEightsViewtype

What one seat can see of a game of Crazy Eights: its own hand, the table, and what has been said and shown.

crazyEightsWinnersfunction

The highest score wins, once somebody reaches the game's size; level on it shares the win.

crazyHandSizefunction

Seven cards each for two players, five for more.

crazyMatchesfunction

Whether this card may go on the pile now: an eight always; otherwise the suit to follow or the top card's rank.

crazyPlayablefunction

The cards the player to move may play now: after drawing, only the card drawn.

crazyPointsfunction

What a card left in hand is worth to the winner of the hand.

crazyTopfunction

The card on top of the discard pile.

decodeCrazyEightsfunction

Text read back into the game of Crazy Eights it records, by playing every move again through the rules; null for anything they cannot play out.

EIGHTconstant

The rank that is wild in Crazy Eights.

encodeCrazyEightsfunction

A game of Crazy Eights as text: its table, its seed and its moves, never a hand.

longestSuitfunction

The suit this hand holds most of, eights aside; clubs first among equals so the choice is always the same.

playCrazyEightsfunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

sortCrazyfunction

A hand as a player holds it: eights last, the rest by suit and rank.

startCrazyEightsfunction

A new game of Crazy Eights for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Crazy Eights is not offered for.

@johnmorrisdotca/toranpu/go-fish

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.

encodeGoFishfunction

A game of Go Fish as text: its table, its seed and its moves, never a hand.

GO_FISH_RULESconstant

Go Fish as one CardGameRules: everything a table asks of the game.

goFishComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

GoFishEventtype

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).

GoFishGametype

A GAME OF GO FISH: its table and moves (what is kept), and what they make.

goFishHandSizefunction

Seven cards each for two or three players, five for more.

goFishMemoryfunction

What the table's log says about every seat's hand, worked out from the asks, the answers and the books.

GoFishMemorytype

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.

GoFishMovetype

Asking one player for every card they hold of one rank.

goFishMovesfunction

Every move the seat to play may make now; none once the game is over.

goFishRanksfunction

The ranks the seat to move may ask for: those it holds.

goFishTargetsfunction

The players the seat to move may ask: everybody else holding cards, or, when nobody else does, anybody else.

goFishViewfunction

The part of the game the seat to play can see, which is all its computer is given.

GoFishViewtype

What one seat can see of a game of Go Fish: its own hand, the table, and what has been said and shown.

goFishWinnersfunction

The most books wins; level on the most shares it.

playGoFishfunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

sortGoFishfunction

A hand as a player holds it: grouped by rank, ace to king.

startGoFishfunction

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.

@johnmorrisdotca/toranpu/big-two

afterTurnfunction

Whose move it is after from played or passed: the next seat still in that has not passed, or — when nobody is left to answer — the trick cleared and led by whoever played last, or the next seat after them still in.

BIG_TWO_RULESconstant

Big Two as one CardGameRules: everything a table asks of the game.

bigTwoBeatsfunction

Whether a play beats the one on the table: the same number of cards, and stronger.

bigTwoCardfunction

A card's height in the whole pack, 0 (three of diamonds) to 51 (two of spades).

bigTwoChargefunction

What a hand left in is charged when somebody goes out: a point a card, double for ten or more, treble for thirteen or more.

bigTwoComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

BigTwoGametype

A GAME OF BIG TWO: its table and moves (what is kept), and the deal they have reached.

BigTwoKindtype

The kinds of play in Big Two, a single to a straight flush.

bigTwoMayPlayfunction

Whether these cards may be played now by the seat to play.

bigTwoMovesfunction

Every move the seat to play may make now; none once the game is over.

bigTwoPlaysfunction

Every play this hand could make, each once, lowest cards first within a kind.

bigTwoRankfunction

A rank's height, the three lowest (0) and the two highest (12).

bigTwoValuefunction

What these cards are worth played together, or null for cards that make no play.

BigTwoValuetype

A play's kind and how strong it is among plays of the same number of cards.

bigTwoViewfunction

The part of the game the seat to play can see, which is all its computer is given.

BigTwoViewtype

What one seat can see of a game of Big Two: its own hand, the table, and what has been said and shown.

bigTwoWinnersfunction

The fewest penalty points wins; level on the fewest shares it.

ClimbMovetype

Cards played to beat the table (or lead), or a pass.

ClimbPlaytype

What is on the table: the last cards played to this trick, and whose they were.

ClimbTricktype

The part of a climbing game's state the trick machinery moves: every climbing game carries these.

decodeBigTwofunction

Text read back into the game of Big Two it records, by playing every move again through the rules; null for anything they cannot play out.

encodeBigTwofunction

A game of Big Two as text: its table, its seed and its moves, never a hand.

freshTrickfunction

A fresh trick to lead, for a new deal.

isClimbMovefunction

A move read back from storage, checked for shape: cards to play, or a pass.

laidfunction

The trick after seat lays these cards on it: out of their hand, on the table, and seen by all.

nextRoundfunction

The next seat round from from (not counting it) that wanted accepts, or null when none does.

passedOnfunction

The trick after seat passes.

playBigTwofunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

seatsInfunction

The seats still holding cards.

sortBigTwofunction

Cards in Big Two's order, lowest first: how a hand is held.

startBigTwofunction

A new game of Big Two for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Big Two is not offered for.

@johnmorrisdotca/toranpu/president

afterTurnfunction

Whose move it is after from played or passed: the next seat still in that has not passed, or — when nobody is left to answer — the trick cleared and led by whoever played last, or the next seat after them still in.

ClimbMovetype

Cards played to beat the table (or lead), or a pass.

ClimbPlaytype

What is on the table: the last cards played to this trick, and whose they were.

ClimbTricktype

The part of a climbing game's state the trick machinery moves: every climbing game carries these.

decodePresidentfunction

Text read back into the game of President it records, by playing every move again through the rules; null for anything they cannot play out.

encodePresidentfunction

A game of President as text: its table, its seed and its moves, never a hand.

freshTrickfunction

A fresh trick to lead, for a new deal.

isClimbMovefunction

A move read back from storage, checked for shape: cards to play, or a pass.

laidfunction

The trick after seat lays these cards on it: out of their hand, on the table, and seen by all.

nextRoundfunction

The next seat round from from (not counting it) that wanted accepts, or null when none does.

passedOnfunction

The trick after seat passes.

playPresidentfunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

PRESIDENT_RULESconstant

President as one CardGameRules: everything a table asks of the game.

presidentComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

PresidentGametype

A GAME OF PRESIDENT: its table and moves (what is kept), and the round they have reached.

presidentMayPlayfunction

Whether these cards may be played now by the seat to play: one rank, one to four of it, higher than the table's and as many.

PresidentMovetype

A climbing move, or the cards a President or Vice-President hands back down at the start of a round.

presidentMovesfunction

Every move the seat to play may make now; none once the game is over.

presidentRankfunction

A rank's height: the three lowest (0), the two highest (12).

PresidentSwaptype

Cards handed over at the start of a round: the best cards up, whatever the receiver chooses back down.

presidentSwapCountfunction

How many cards the President and the Beggar swap: two, or one when only three are at the table.

PresidentTitletype

Each seat's title from a round's finishing order: 0 President, 1 Vice-President, the last two Vice-Beggar and Beggar, everybody else a Citizen.

presidentViewfunction

The part of the game the seat to play can see, which is all its computer is given.

PresidentViewtype

What one seat can see of a game of President: its own hand, the table, and what has been said and shown.

seatsInfunction

The seats still holding cards.

sortPresidentfunction

Cards in President's order, lowest first, suits in a fixed order only so a hand always sorts the same way.

startPresidentfunction

A new game of President for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table President is not offered for.

@johnmorrisdotca/toranpu/gin-rummy

bestLayoutfunction

The hand laid out to leave the least deadwood: the melds chosen, none sharing a card, and what is left.

canKnockWithfunction

Whether throwing this card, from a hand of eleven, leaves little enough deadwood to knock with.

chooseThrowfunction

The card to throw: the one leaving the least deadwood; of those, not a card the other player could use, and the highest.

deadwoodInfunction

The deadwood left in a hand at its best.

deadwoodOffunction

What a list of cards counts as deadwood, added up.

deadwoodValuefunction

A card's deadwood: an ace one, the numbers their number, a jack, queen or king ten.

decodeGinfunction

Text read back into the game of Gin Rummy it records, by playing every move again through the rules; null for anything they cannot play out.

encodeGinfunction

A game of Gin Rummy as text: its table, its seed and its moves, never a hand.

GIN_BONUSconstant

The bonus for gin, and for an undercut.

GIN_RUMMY_RULESconstant

Gin Rummy as one CardGameRules: everything a table asks of the game.

GIN_SEATSconstant

How many play Gin Rummy: two.

ginComputerfunction

The move a computer in the seat to play makes: always one the rules allow.

GinGametype

A GAME OF GIN RUMMY: its table and moves (what is kept), and the hand they have reached.

GinLayouttype

Each hand's player, laid out: their melds, and the cards left over.

GinMeldtype

A meld: three or four of a rank, or a run of three or more in one suit.

GinMovetype

A card drawn from the stock or taken from the discard pile, or a card thrown: laid on the pile, or face down to knock.

ginMovesfunction

Every move the seat to play may make now; none once the game is over.

GinResulttype

How a hand ended: who scored and how much, and how each hand was laid down.

ginSensiblefunction

A player a test can play at random who still ends a hand: a random draw and a random throw, but a knock whenever the card thrown allows one.

ginViewfunction

The part of the game the seat to play can see, which is all its computer is given.

GinViewtype

A COMPUTER AT THE GIN RUMMY TABLE: it takes the discard only when the card goes straight into a meld, throws the card that leaves the least deadwood (the highest of those that tie, and never one the other player has shown they are collecting when another will do), and knocks the moment it can.

ginWinnersfunction

The first to the game's total wins.

isMeldfunction

Whether these cards are a meld: three or four of a rank, or three or more in a row in one suit.

KNOCK_MOSTconstant

The most deadwood a player may knock with.

layOfffunction

The defender's side of a knock: their own melds first, then every card left that fits one of the knocker's melds laid off onto it — a run grown one card at a time, so a six can follow the five just laid.

meldsInfunction

Every meld that can be made from these cards: each set of three or four, and each run of three or more.

playGinfunction

The game after that move, with the move added to its record, or null for a move the rules refuse.

sortGinfunction

A hand sorted as a player holds it: by suit (spades, hearts, clubs, diamonds, as the colours alternate), ace low.

startGinfunction

A new game of Gin Rummy for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Gin Rummy is not offered for.

UNDERCUT_BONUSconstant

The bonus for an undercut: the defender has no more deadwood than the knocker.

wantedfunction

Whether the discard would go straight into a meld: the hand with it and its best throw has less deadwood than now.

@johnmorrisdotca/toranpu/war

decodeWarfunction

Text read back into the game of War it records, by playing every move again through the rules; null for anything they cannot play out.

encodeWarfunction

A game of War as text: its table, its seed and its moves, never a pile.

isWarMovefunction

Whether something is the one move War has.

playWarfunction

The game after the cards are turned over: the whole turn, through however many wars it takes, or null for a move the rules refuse.

startWarfunction

A new game of War for these two players at this size (how many turns it may last), dealt from the seed, or null for a table War is not offered for.

WAR_FACE_DOWNconstant

The cards a player lays in a war before the one turned up.

WAR_RULESconstant

War as one CardGameRules: everything a table asks of the game.

warComputerfunction

The move a computer makes: the only one War has.

WarEndtype

Why a game of War ended: one player has every card ("cleared"), a player could not finish a war and the other could, or both could not and one ran out first ("short"), both ran out together ("drawn"), or the turns ran out ("limit").

WarGametype

A GAME OF WAR: its table and moves (what is kept), and what they make.

WarLaidtype

One card laid in a turn: who laid it, and whether it lay face down (the three of a war) or was turned up.

WarMovetype

The one thing a player does at War: turn the top cards over.

warMovesfunction

Every move the table may make now: turning the cards over, until the game is over.

warRankfunction

How a rank counts at War: the ace highest, then king down to two.

WarTurntype

What the table saw of the last turn: every card laid, in the order laid, how many wars the turn went through (0 for a plain turn of the cards), and who took the cards (null when the turn ended the game on a war that was not finished).

warWinnersfunction

The seats that won a game that is over: the player with more cards, both when the piles are level or the game was a draw; nobody while it goes on.

@johnmorrisdotca/toranpu/stack-up

decodeStackUpfunction

Text read back into the game of Stack Up it records, by playing every move again through the rules; null for anything they cannot play out.

encodeStackUpfunction

A game of Stack Up as text: its table, its seed and its moves, never a hand.

isStackUpMovefunction

Whether something is a move Stack Up has, by its shape.

playStackUpfunction

The game after a move, or null for a move the rules refuse.

STACK_UP_DECKconstant

The whole deck of 162 cards, in a fixed order: 1 to 12 twelve times over, then the wilds.

STACK_UP_PILESconstant

The four building piles in the middle, and the four discard piles each player has.

STACK_UP_RULESconstant

Stack Up as one CardGameRules: everything a table asks of the game.

STACK_UP_TOPconstant

The highest number on a card, and the length a building pile is finished at.

stackUpComputerfunction

The move a computer makes: the best play it has, or else the card it would miss least, put where it does least harm.

StackUpEndtype

Why a game is over: someone played their last stock card, or nothing could be played for a whole round with no cards left to draw, and the fewest stock cards left wins.

stackUpFitsfunction

Whether a card may go on a building pile: a wild always, a number when it is the one the pile wants.

StackUpGametype

A game of Stack Up: every seat's stock, hand and four discard piles, the four building piles, the cards still to draw and the finished piles waiting to be shuffled back in.

StackUpMovetype

One move at Stack Up: a card laid on a building pile (from the hand, the top of the stock, or the top of one of your own discard piles), a card put on a discard pile, which ends the turn, or a pass when there is nothing in hand to discard.

stackUpMovesfunction

Every move the seat to play may make: each card that fits a building pile, from the hand, the stock or a discard pile; each card of the hand on each discard pile; and a pass when the hand is empty.

stackUpValuefunction

What a card counts for: its number 1 to 12, or 0 for a wild, which is whatever a pile wants.

stackUpWantsfunction

What number a building pile wants next: one more than the cards on it.

stackUpWinnersfunction

The seats that won a game that is over: the one who emptied their stock, or at a stuck table those with the fewest cards left; empty while it is being played.

startStackUpfunction

A new game of Stack Up for two to six players with a stock pile of this size, dealt from the seed, or null for a table it is not offered for.

@johnmorrisdotca/toranpu/klondike

allFaceUpfunction

Whether every card on the columns is face up: from here the game plays itself out (autoFinish).

bestFirstfunction

A winning line from this table — every move a replay of it makes, the settling ones included — or null when none was found within budget tables.

BestFirstGametype

A BEST-FIRST SEARCH for a card game played alone, shared by FreeCell's solver and Spider's (freecell/solve.ts, spider/solve.ts).

carriedFromfunction

Which card of a column a carry to to would take: the one face-up card whose run fits there, or null.

columnAtfunction

Which column, from 0, a pile a move names is.

COLUMNSconstant

How many columns the tableau has.

dealKlondikefunction

Deal a deck (card numbers, the first dealt first) into a table: column by column along each row, as a dealer does.

dealOffunction

A deal string from card numbers.

dealOfSeedfunction

The deal of a seed: the site's one shuffle (shuffledDeck), written down.

deckOffunction

The deck a deal string names, as card numbers, or null for one that is not a whole deck.

decodeMovesfunction

A move list read back, or null for one with a character that is no move.

DRAW_CODEconstant

The letter a draw from the stock is written as, in a move list.

encodeMovefunction

One move written as text: one or two letters.

encodeMovesfunction

A list of moves written as text, one after another with nothing between.

finishingMovesfunction

THE GAME PLAYS ITSELF OUT once every card on the columns is face up: the moves that bring the rest home, found by the solver on a small budget (a table with nothing hidden is solved in a handful of tables), or null while a card is still face down or no way home is found — then the player goes on.

fitsColumnfunction

Whether a card may go onto a column: onto a card one higher of the other colour, or a King onto an empty one.

fitsFoundationfunction

Whether a card may go onto its suit's foundation now.

FOUNDATION_PILESconstant

The foundations' letters, in SUITS order (spades, hearts, diamonds, clubs), as a card id writes a suit.

foundationAtfunction

Which foundation, from 0 in SUITS order, a pile a move names is.

homeMovefunction

The move that sends a top card home, if it can go: what a double tap does.

isColumnPilefunction

Whether a pile a move names is a column.

isSafeHomefunction

Whether a card is one the solver treats as home safely: exported for its test.

KlondikeColumntype

One of the seven columns: its cards from the bottom up, of which the first down lie face down.

KlondikeMovetype

One move: turn cards from the stock (draw), turn the waste back over (recycle), or carry cards from one pile to another.

KlondikePiletype

A place on the table a move names: the stock s, the waste w, a suit's foundation by its letter (S H D C, as a card id writes a suit), or a column 1–7.

KlondikeRulestype

How the game was set up: cards turned from the stock at a time, and how many times through the stock (Infinity for no limit).

KlondikeTabletype

A game of Klondike as it stands: every pile, and the rules it is played under.

liftablefunction

The cards a person can take hold of from a spot, the one held and every one on it, or none: the waste's top card, a foundation's top card, or any face-up card of a column with the run on top of it.

moveForfunction

The move that carries the cards held at from to to, if the rules allow exactly those cards there.

movesFromfunction

Every move the rules allow from this table, in a fixed order: to the foundations first, then onto the columns, then the stock.

pileCardsfunction

The cards of a pile, bottom first, as the table holds them.

playKlondikefunction

The table after a move, or null where the rules refuse it.

rankOffunction

A card's rank, 1 for an ace to 13 for a king.

RANKS_A_SUITconstant

How many ranks a suit has, ace to king.

RECYCLE_CODEconstant

The letter turning the waste back over is written as, in a move list.

recyclesLeftfunction

How many times the waste may still be turned back: passes less one, less those already made.

redCardfunction

Hearts and diamonds, the second and third suits.

replayfunction

A game played out from its deal: every table it passed through, the first the deal, or null where the deal is not a deck or a move is one the rules refuse.

solveKlondikefunction

A winning line from this table — every move, the safe ones home included, that a replay of it makes — or null when none was found within budget tables.

stockMovefunction

What a press on the stock does: turn it, or turn the waste back over, or nothing once the passes are spent.

stuckfunction

Whether nothing can be done but give up: no card can move anywhere, and the stock can be neither turned nor turned back.

suitOffunction

A card's suit, 0 to 3 in SUITS order.

TableSpottype

A card on the table, as a person points at it: the pile, and its place from the bottom (-1 for the pile's empty place).

@johnmorrisdotca/toranpu/freecell

bestFirstfunction

A winning line from this table — every move a replay of it makes, the settling ones included — or null when none was found within budget tables.

BestFirstGametype

A BEST-FIRST SEARCH for a card game played alone, shared by FreeCell's solver and Spider's (freecell/solve.ts, spider/solve.ts).

CELL_PILESconstant

The free cells, as a move names them: as many as the game is played with, from the first.

cellAtfunction

Which free cell, from 0, a pile a move names is.

columnAtfunction

Which column, from 0, a pile a move names is.

COLUMNSconstant

How many columns the tableau has.

countOntofunction

How many cards a carry from one column to another takes, where it is not the player's to say: onto a card, the one count whose foot fits it.

dealFreeCellfunction

Deal a deck (card numbers, the first dealt first) into a table with so many free cells: one card to each column in turn.

dealOfSeedfunction

The deal of a seed: the site's one shuffle (shuffledDeck), written down.

deckOffunction

The deck a deal string names, as card numbers, or null for one that is not a whole deck.

decodeMovesfunction

A move list read back, or null for one with a character that is no move.

encodeMovefunction

One move written as text: one or two letters.

encodeMovesfunction

A list of moves written as text, one after another with nothing between.

fitsFoundationfunction

Whether a card may go onto its suit's foundation now.

followsfunction

Whether upper may lie on lower in a column: one lower, of the other colour.

FOUNDATION_PILESconstant

The foundations' letters, in SUITS order (spades, hearts, diamonds, clubs), as a card id writes a suit.

foundationAtfunction

Which foundation, from 0 in SUITS order, a pile a move names is.

FREECELL_PILESconstant

Every pile's letter, for a move written down to be read back.

freeCellFinishingMovesfunction

THE GAME PLAYS ITSELF OUT once nothing is left to decide: when every card still out can go home in turn, the lowest first, the moves that take them there — or null while one cannot, and the player goes on.

freeCellHomeMovefunction

The move that sends a top card home, if it can go: what a double tap does.

freeCellLiftablefunction

The cards a person can take hold of from a spot, the one held and every one on it, or none: a free cell's card, or a column's card with the run in order on top of it.

FreeCellMovetype

One move: count cards carried from one pile to another.

freeCellMoveForfunction

The move that carries the cards held at from to to, if the rules allow exactly those cards there.

FreeCellPiletype

A place on the table a move names: a column 1–8, a free cell a–d, or a suit's foundation by its letter (S H D C, as a card id writes a suit).

freeCellPileCardsfunction

The cards of a pile, bottom first, as the table holds them.

FreeCellSpottype

A card on the table, as a person points at it: the pile, and its place from the bottom (-1 for the pile's empty place).

freeCellStuckfunction

Whether nothing can be done but give up: no card can move anywhere.

FreeCellTabletype

A game of FreeCell as it stands: the columns, the free cells and the foundations.

isCellPilefunction

Whether a pile a move names is a free cell.

isColumnPilefunction

Whether a pile a move names is a column.

mostCarriedfunction

The most cards a carry may take, as though moved one at a time: one more than the empty free cells, doubled for every empty column but the one the cards are going to.

movesFromfunction

Every move the rules allow from a table, one of each (the longest run into an empty column), for a stuck-game check.

playFreeCellfunction

The table after a move, or null where the rules refuse it.

rankOffunction

A card's rank, 1 for an ace to 13 for a king.

RANKS_A_SUITconstant

How many ranks a suit has, ace to king.

redCardfunction

Hearts and diamonds, the second and third suits.

replayFreeCellfunction

A game played out from its deal: every table it passed through, the first the deal, or null where the deal is not a deck or a move is one the rules refuse.

runLengthfunction

How many cards on top of a column are in order, each on the one under it: the most a single carry could ever take.

solveFreeCellfunction

A winning line from this table — every move a replay of it makes, the safe ones home included — or null when none was found within budget tables.

suitOffunction

A card's suit, 0 to 3 in SUITS order.

topOffunction

The top card of a pile, or undefined where it holds none (a foundation's top is its suit at its count).

@johnmorrisdotca/toranpu/spider

allShowingfunction

Whether every card is dealt and face up: from here the game plays itself out, where it can (finishingMoves).

bestFirstfunction

A winning line from this table — every move a replay of it makes, the settling ones included — or null when none was found within budget tables.

BestFirstGametype

A BEST-FIRST SEARCH for a card game played alone, shared by FreeCell's solver and Spider's (freecell/solve.ts, spider/solve.ts).

canDealfunction

Whether the stock can deal now: cards left, and no column empty.

COLUMNSconstant

How many columns the tableau has.

countOntofunction

How many cards a carry from one column onto another takes, where it is not the player's to say: onto a card, the one count whose foot is one lower.

DEAL_CODEconstant

The letter dealing a card to every column is written as, in a move list.

dealSpiderfunction

Deal a shuffled deck (card numbers, the first dealt first) into a table.

DEALTconstant

Cards dealt to the columns before play; the rest are the stock.

DECK_SIZEconstant

How many cards two decks hold, which Spider is played with at any number of suits.

decodeMovesfunction

A move list read back, or null for one with a character that is no move.

encodeMovefunction

One move written as text: one or two letters.

encodeMovesfunction

A list of moves written as text, one after another with nothing between.

movesFromfunction

Every move the rules allow from a table, one of each (the whole run into an empty column), for a stuck-game check.

playSpiderfunction

The table after a move, or null where the rules refuse it.

rankOffunction

A card's rank, 1 for an ace to 13 for a king.

RANKS_A_SUITconstant

How many ranks a suit has, ace to king.

replaySpiderfunction

A game played out from its deal: every table it passed through, the first the deal, or null where the deal is not two decks or a move is one the rules refuse.

runLengthfunction

How many cards on top of a column are one suit and in order, all face up: the most a carry can take.

RUNS_TO_WINconstant

Full runs to make: two decks of four suits.

solveSpiderfunction

A winning line from this table, or null when none was found within budget tables.

spiderBestMovefunction

What a double tap does in Spider, where no card goes home by itself: the run carried to the best column that takes it — one whose top is its own suit, else any card one higher, else an empty column.

SpiderColumntype

One of the ten columns: its cards from the bottom up, of which the first down lie face down.

spiderColumnOffunction

The column a pile names, or null for the stock and the made runs.

spiderDealMovefunction

What a press on the stock does: deal, or nothing while a column is empty or the stock is spent.

spiderDealOfSeedfunction

The deal of a seed at so many suits: the site's one shuffle (shuffled) of both decks, written down.

spiderDeckfunction

The hundred and four cards of a game of so many suits, sorted: each suit's thirteen, as many times as fill two decks.

spiderDeckOffunction

The cards a deal string names, or null for one that is not both decks of a game of so many suits.

spiderFinishingMovesfunction

THE GAME PLAYS ITSELF OUT once every card is dealt and face up: the moves that make the runs left, found by the solver on a small budget, or null while a card is hidden or no way is found — then the player goes on.

spiderLiftablefunction

The cards a person can take hold of from a spot: a face-up card with the run of its own suit, in order, on top of it.

SpiderMovetype

One move: deal a card from the stock onto every column (deal), or carry count cards from the top of one column onto another.

spiderMoveForfunction

The move that carries the cards held at from onto the column to, if the rules allow exactly those cards there.

SpiderSpottype

A place a tap lands on the table: the pile, and which card in it from the bottom.

spiderStuckfunction

Whether nothing can be done but give up: no card can move and the stock cannot deal.

SpiderTabletype

A game of Spider as it stands: the columns, the cards still to deal, and the runs sent home.

spiderWonfunction

Whether all eight runs are made.

suitOffunction

A card's suit, 0 to 3 in SUITS order.

suitsForfunction

The suits a game of so many suits is played with, in SUITS order: spades; spades and hearts; all four.

@johnmorrisdotca/toranpu

CARD_GAME_KINDSconstant

The twelve kinds by name, for code that would rather not type a string twice.

CARD_GAME_RULESconstant

EVERY CARD GAME'S RULES, by kind: what a table plays and what the simulation plays out.

CARD_GAME_TABLESconstant

Every game's table: the fewest, the most and the usual number of players, the lengths of game offered and the usual one.

cardGameCodecfunction

The keeping for one game: game names it, so one game's text is never read as another's; start and play are its rules; isMove checks a move's shape before the rules are asked about it.

CardGameCodectype

A game's keeping: encode writes it as text, decode reads it back or gives null.

CardGameKindtype

THE CARD GAMES, and the tables each offers.

CardGamePlaystype

Each card game's game and move, so its rules can be named with their own types.

CardGameRulestype

WHAT EVERY CARD GAME'S RULES ANSWER, whatever the game.

CardGameTabletype

What a game's table offers: how many may sit at it, and how long a game may last.

CardIdtype

A card by its short name: rank letter then suit letter, "QS", "TD", "AH" (cards.ts).

cardOffunction

The card of this rank and suit.

cardOfIdfunction

The deck's card for an id, for the deck's components to draw.

CardRanktype

The deck's rank, ace low: 1 is the ace, 11 the jack, 12 the queen, 13 the king.

CardSeatstype

Who sits in each seat: the name the set-up gave, and whether a computer plays it.

cardShortfunction

A card as a corner shows it: "Q♠", "10♦".

cardsShortfunction

Cards as corners show them, with a space between: "Q♠ 10♦ A♥".

CardSuittype

Clubs, diamonds, hearts, spades.

cardTextfunction

A card's name in full: "queen of spades", or "スペードのクイーン" in Japanese.

cardWordsfunction

"queen of spades", as a sentence and a screen reader say it.

choicesfunction

Every way of choosing count of these cards, in the order they are given.

cliLanguagefunction

The language the command line speaks: --lang, or the environment's, or the system's; Japanese for ja…, English for anything else.

computerSeatsfunction

The seats a computer plays, one a seat, from what the set-up said: a seat it said nothing about is a person's.

CRIBBAGE_SIZESconstant

The scores a game of Cribbage may be played to: once round the board, or twice.

dealRoundfunction

Deals the cards one at a time round the table, from the first seat, as a dealer does: each to a seat, or every card when each is absent (so some seats hold one more than others).

EUCHRE_SIZESconstant

The scores a game of Euchre may be played to.

fillInfunction

Put values into a string's braces: fillIn("Bid {n}", { n: 3 }) is "Bid 3".

fromCodefunction

A game from its code or its JSON: the same as fromJSON, under the name that pairs with toCode.

fromJSONfunction

A game from text that toJSON or toCode wrote, whichever game it is.

FULL_DECKconstant

Every card, in the deck's own order.

gameNamefunction

A game's name: "Hearts", or "ハーツ" in Japanese.

GameOftype

A game of that kind, in progress.

gameSaysfunction

A game in a line: what it is about, for a list of games.

GIN_SIZESconstant

The scores a game of Gin Rummy may be played to.

HEARTS_SIZESconstant

How long each game lasts, in its own terms (see above).

isCardfunction

Whether this is one of the fifty-two names.

isCardListfunction

A list of card names, checked for shape only: whether they are cards the game holds is the rules' to say.

KeptCardGametype

What every card game's state carries for its keeping.

Languagetype

The languages Toranpu speaks.

languageOffunction

The language a tag such as ja-JP or en_US.UTF-8 names: Japanese for anything that starts ja, English otherwise.

mixSeedfunction

Two numbers folded into one seed, so each deal of a game (and each reshuffle within one) has its own order.

MoveOftype

A move in a game of that kind.

moveTextfunction

A move in words, for any of the twelve games: moveText("hearts", { play: "QS" }) is "Play Q♠", and with { form: "did" } it is "plays Q♠".

namesListfunction

Names in a list: "Ann, Ben", or "Ann、Ben" in Japanese.

newGamefunction

A new game of that kind, or null when the game is not offered for that table (too many players, or a size it does not play to).

nextSeatfunction

The next seat round the table, to the left: the order every game here plays in.

OH_HELL_DEALSconstant

How many deals a game of Oh Hell may last: up to seven cards, or up and back down.

playComputersfunction

Every computer move due, played in turn until a person is to move or the game is over.

Randomtype

A number in [0, 1), like Math.random, from a stream a seed fixes.

randomSeedfunction

A seed for a game nobody asked for by number: a whole number from 1 to 2³¹ − 1.

RANK_LETTERSconstant

The rank letters, ace low: an index here plus one is the rank (A = 1, J = 11, Q = 12, K = 13).

rankNamefunction

A rank as a sentence names one card of it: "queen", "seven"; in Japanese "クイーン", "7".

rankOffunction

A card's rank, ace low: 1 to 13.

rankWordsfunction

A rank named in the plural, as it is asked for: "sevens", "sixes", "queens".

ReadGametype

A game read back: which game it is, and the game itself.

RecordedMovetype

One move of a record: which seat made it, and the move.

recordOffunction

Every move of a game with the seat that made it, in order, found by playing the game through again from its seed.

reshuffledfunction

These cards shuffled again, the same way for the same seed and salt: a pile turned over to make a new stock.

rulesForfunction

A game's rules by its kind, with its own game and move types.

runClifunction

Run the command line.

SAVE_FORMATconstant

The shape of the JSON this package writes.

savedGamefunction

A game as the object toJSON writes: its table, its seed and its moves.

seededRandomfunction

A stream of numbers in [0, 1) fixed by a seed.

shuffledfunction

A copy of the list in a random order (Fisher–Yates); the list given is left alone.

shuffledDeckfunction

The deck shuffled for one deal of one game: the same seed and deal always the same order, so a game kept as its seed and moves deals itself again exactly, and reloading can never re-deal a hand somebody has seen.

SPADES_SIZESconstant

The scores a game of Spades may be played to.

STACK_UP_SIZESconstant

The cards in each player's stock pile at a game of Stack Up: the longer, the longer the game.

STRINGSconstant

Every string, in both languages.

suitNamefunction

A suit's name: "spades", or "スペード" in Japanese.

suitOffunction

A card's suit, as its letter: S, H, D or C.

suitSymbolfunction

A suit's symbol: ♠ ♥ ♦ ♣.

toCodefunction

A game as its code: the one line its own rules' encode writes.

toCSVfunction

A game's moves as CSV for a spreadsheet: a header, then a row a move, with its number from 1, the seat from 1 and its player, the kind of move (play, bid, pass…), the cards it names as two-letter ids with spaces between, the move itself as JSON, and the move in English.

toJSONfunction

A game as JSON, two spaces deep, with the format's number first.

toTextfunction

A game as a record a person can read: a heading, a numbered line a move with who made it, and how it stands.

VERSIONconstant

The version of this package, as package.json has it.

WAR_ROUNDSconstant

How many turns of the cards a game of War may last before the player holding more cards wins.

withoutfunction

The hand without these cards, or null when it does not hold every one of them.