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

President

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

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

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

Exports

NameKindWhat it is
afterTurnfunctionWhose 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.
ClimbMovetypeCards played to beat the table (or lead), or a pass.
ClimbPlaytypeWhat is on the table: the last cards played to this trick, and whose they were.
ClimbTricktypeThe part of a climbing game's state the trick machinery moves: every climbing game carries these.
decodePresidentfunctionText read back into the game of President it records, by playing every move again through the rules; null for anything they cannot play out.
encodePresidentfunctionA game of President as text: its table, its seed and its moves, never a hand.
freshTrickfunctionA fresh trick to lead, for a new deal.
isClimbMovefunctionA move read back from storage, checked for shape: cards to play, or a pass.
laidfunctionThe trick after seat lays these cards on it: out of their hand, on the table, and seen by all.
nextRoundfunctionThe next seat round from from (not counting it) that wanted accepts, or null when none does.
passedOnfunctionThe trick after seat passes.
playPresidentfunctionThe game after that move, with the move added to its record, or null for a move the rules refuse.
PRESIDENT_RULESconstantPresident as one CardGameRules: everything a table asks of the game.
presidentComputerfunctionThe move a computer in the seat to play makes: always one the rules allow.
PresidentGametypeA GAME OF PRESIDENT: its table and moves (what is kept), and the round they have reached.
presidentMayPlayfunctionWhether 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.
PresidentMovetypeA climbing move, or the cards a President or Vice-President hands back down at the start of a round.
presidentMovesfunctionEvery move the seat to play may make now; none once the game is over.
presidentRankfunctionA rank's height: the three lowest (0), the two highest (12).
PresidentSwaptypeCards handed over at the start of a round: the best cards up, whatever the receiver chooses back down.
presidentSwapCountfunctionHow many cards the President and the Beggar swap: two, or one when only three are at the table.
presidentTitlefunctionA seat's title from a round's finishing order.
PresidentTitletypeEach 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.
presidentViewfunctionThe part of the game the seat to play can see, which is all its computer is given.
PresidentViewtypeWhat one seat can see of a game of President: its own hand, the table, and what has been said and shown.
presidentWinnersfunctionThe most points wins; level on the most shares it.
seatsInfunctionThe seats still holding cards.
sortPresidentfunctionCards in President's order, lowest first, suits in a fixed order only so a hand always sorts the same way.
startPresidentfunctionA 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.

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