Skip to the content

Hitotsu documentation

Hitotsu 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/hitotsu/react

HitotsuCardDrawingfunction

One card's drawing, to go inside any SVG whose box is 100 by 140: a face, or the back for null.

HitotsuCardImagefunction

A card as a whole SVG, sized by its parent or its own width: <HitotsuCardImage card="R70" width={80} />.

HitotsuTablefunction

A whole table, you against computers, as a React component: <HitotsuTable rules={HITOTSU_PARTY} players={["You", "Aki", "Ben"]} />.

HitotsuTablePropstype

Native table settings and div attributes for the React component, with an optional onReady callback.

@johnmorrisdotca/hitotsu/element

defineHitotsuTablefunction

Register a default or custom-tag native table; safe on servers and idempotent.

defineTablefunction

Standard table registration helper.

@johnmorrisdotca/hitotsu/element/define

defineHitotsuTablefunction

Register a default or custom-tag native table; safe on servers and idempotent.

defineTablefunction

Standard table registration helper.

@johnmorrisdotca/hitotsu/element-define

defineHitotsuTablefunction

Register a default or custom-tag native table; safe on servers and idempotent.

defineTablefunction

Standard table registration helper.

@johnmorrisdotca/hitotsu/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.

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/hitotsu

callMattersfunction

Whether the call is a choice now: this seat is about to play its second-last card.

cardOfMovefunction

The card a card move puts down.

Clothtype

A cloth's name.

clothVarsfunction

A cloth as CSS variables; nothing for a name that is not a cloth, so the defaults stay.

colourOffunction

A card's colour, or null for a wild.

colourWordsfunction

A colour’s name in English or Japanese.

decodeHitotsufunction

Read a saved setup and replay every logged move through the native rules; null for an unreadable, unsupported or illegal saved game.

DRAW_TWOconstant

The face code for a Draw Two card.

encodeHitotsufunction

Save the setup, seed and ordered move log as JSON text; hands and piles are reconstructed when decoded.

faceOffunction

A card's face: a digit, or S, R, D, W, F.

freshSeedfunction

A fresh seed for a new deal.

handOffunction

A seat's hand; an empty one for a seat the table does not have.

HITOTSU_ALL_WILD_DECKconstant

The cards of the all-wild deck: 112 wilds, none of them with a colour: 32 plain, 24 each of Skip and Reverse, 20 Draw Two and 12 Wild Draw Four.

HITOTSU_CAUGHTconstant

Cards taken for going down to one without calling it, and for a Wild Draw Four challenged and found honest.

HITOTSU_CLASSICconstant

The published rules: no stacking, no jumping in, sevens and zeros as plain numbers, one card drawn, a Wild Draw Four that may be challenged, seven cards dealt.

HITOTSU_CLOTHSconstant

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

HITOTSU_COLOUR_LOOKconstant

Each colour's fill, the ink written on it, its element and its name; W is the wilds' and the back's.

HITOTSU_COLOURSconstant

The four colours in the order a hand sorts them and a picker offers them.

HITOTSU_FACE_MARKconstant

What each face shows in the middle of a card and in its corners; a number shows itself.

HITOTSU_MODESconstant

The modes a table can be set up with, the classic deck first.

HITOTSU_MOST_PLAYERSconstant

The most at a table: eight, which one deck of 108 deals seven each and leaves a stock to draw from.

HITOTSU_ONE_HANDconstant

HOW LONG A GAME OF HITOTSU LASTS, its "size": to 200 or 500 points, or a single hand (1), the party table's game.

HITOTSU_PAPERconstant

The card's paper, round every card and under the diamond.

HITOTSU_PARTYconstant

PARTY MODE: the house rules a big table plays by, and a short game — five cards each, one hand, draw cards stacking on any draw card, jumping in, and sevens and zeros moving hands round.

HITOTSU_POINTSconstant

What a card left in a hand is worth to the player who went out: its number, twenty an action card, fifty a wild.

HITOTSU_SIZESconstant

Supported match lengths: one hand, 200 points or 500 points.

HITOTSU_STRINGSconstant

Native interface, settings and words for host code.

HitotsuCardtype

A card by its short name: its colour letter (W for a wild), its face — a digit, S skip, R reverse, D draw two, W wild, F wild draw four — and which copy of that card it is, so the two red fives are R50 and R51.

hitotsuCardShapesfunction

The shapes of one card, in drawing order: a face, or the back for null.

hitotsuCardSvgfunction

A whole card as an SVG document, width pixels wide (140/100 of it tall): a face, or the back for null.

HitotsuChallengetype

A Wild Draw Four the player to move may challenge: who played it, and whether they held a card of the colour it was played on.

hitotsuComputerfunction

Choose a move for the current player from the legal choices.

hitotsuComputerJumpfunction

A computer's card played out of turn, where the table jumps in: the first computer seat round from the player to move that holds a card identical to the top one.

HitotsuGametype

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

HitotsuHandletype

Native game access, redealing and presentation updates.

hitotsuJumpInsfunction

JUMPING IN: with the option on, any other player holding a card identical to the one on top — same colour, same face, never a wild — may play it out of turn, and play goes on from them.

HitotsuLanguagetype

The languages the table speaks: English, and Japanese ("ja").

hitotsuLanguageOffunction

The language a language tag such as "ja", "ja-JP" or "en-GB" asks for: Japanese for any ja, English for everything else, and for nothing.

hitotsuLaunchfunction

How many cards the launcher fires, from the seed and how many moves have been made: the same for the same game, never the same twice in a row.

hitotsuMatchesfunction

Whether a card may go on the pile on an ordinary turn: a wild always; otherwise the colour to follow, or the top card's face.

HitotsuModetype

Which deck and which kind of drawing a table plays with: the classic game, a deck of wilds only (all-wild), or a launcher that fires a random number of cards in place of a draw pile (launcher).

HitotsuMovetype

One move: a card played, a draw, a turn passed, a pending draw taken, a Wild Draw Four challenged, or a card played out of turn.

hitotsuMovesfunction

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

HitotsuNewstype

Something that happened in the last move, for the table to say: nothing a player could not have seen.

hitotsuOpeningColourfunction

The colour an all-wild hand opens on, from the seed: there is no coloured card to start it.

HitotsuOptionstype

How the house plays: each popular variant, as a choice at the set-up.

hitotsuPlayablefunction

The cards the player to move may play now: on a draw, what stacks; after drawing, the card drawn if it goes.

hitotsuPointsfunction

What a card left in hand is worth to the player who went out.

HitotsuResulttype

How a hand ended: who won it and what they scored, or who held least when nobody could go on.

hitotsuStringsfunction

The table's words in a language: HITOTSU_STRINGS for "en", HITOTSU_STRINGS_JA for "ja".

HitotsuStringstype

Every table word, including embed errors; hosts may override them with strings.

HitotsuTableSetUptype

What a set-up sends beyond a length and the seats: the seed it was dealt from, and the house rules.

hitotsuTopfunction

The top card of the discard pile.

hitotsuViewfunction

One seat’s hand and legal choices, with public counts and the current colour, for a computer player.

hitotsuWinnersfunction

Once the game is over: whoever went out in a game of one hand; otherwise the highest score, level on it sharing the win.

hitotsuWordsfunction

"red five", "blue draw two", "wild draw four", as a sentence and a screen reader say it; in Japanese, "赤の5", "青のドロー2", "ワイルドドローフォー".

identicalfunction

Whether two cards are the same card to play (the two red fives are).

isClothfunction

Whether a text names a cloth.

isDrawCardfunction

Whether a card makes somebody draw: a Draw Two or a Wild Draw Four.

isHitotsuCardfunction

Whether an unknown value is an actual physical card id from the deck.

isNumberfunction

Whether a card is a number, 0 to 9.

isWildfunction

Whether a card is a Wild or Wild Draw Four.

longestColourfunction

The colour this hand holds most of, red first among equals so the choice is always the same.

mixSeedfunction

Two numbers mixed into one seed, so each hand of a game is shuffled from its own.

mountHitotsufunction

Put a table of Hitotsu into an element: the person at this screen in seat 0, computers in the rest.

movesForfunction

Everything this seat may do now: its own turn's moves, or, at another's turn, the cards it may jump in with.

namedTablefunction

The game with its seats' names written in, a seat with no name keeping the one it had.

playableForfunction

The cards this seat may play now, in turn or jumping in.

playHitotsufunction

Apply a legal move and return a new game with that move recorded; null for an illegal move or a finished game.

quickMovefunction

What a card tapped twice plays: its one way, or null where there is a colour or a seat to choose.

Randomtype

A source of numbers in [0, 1): Math.random, or a seeded one so a deal can be made again.

readHitotsuMovefunction

A move as something sent it, checked for its shape only: whether it may be made is the rules'.

readHitotsuOptionsfunction

House rules as something sent them, checked for shape, or null.

readTableMovefunction

A move as a device sent it, checked for its shape, or null; a jump is never a move at a table on several devices.

readTableSetUpfunction

The set-up as a device sent it, checked for its shape, jumping in taken off, or null.

reshuffledHitotsufunction

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

REVERSEconstant

The face code for a Reverse card.

SEED_MOSTconstant

The largest seed a deal takes: a whole number that travels in an address or a request as it is.

seededRandomfunction

A seeded generator (mulberry32): the same seed gives the same numbers, on every machine.

shuffledfunction

A shuffled copy (Fisher–Yates); the list given is left as it was.

shuffledHitotsufunction

The deck shuffled for one hand of one game: the same seed and hand always the same order.

SKIPconstant

HITOTSU'S DECK, as the rules see it: 108 short names.

sortHitotsufunction

A hand as a player holds it: by colour, numbers then actions, the wilds last.

startHitotsufunction

Deal a new seeded game for two to eight players at a supported match length; null for an unsupported length or player count.

startTablefunction

A new table: count seats with blank names (a table's names are its seats', written in when it is shown), the seats in computers played by the computer player.

tableComputerMovefunction

The computer player's move for this seat, or null when the table is not waiting on it.

tableToPlayfunction

The seat the table waits on, or null once the game is over.

VERSIONconstant

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

waysForfunction

The ways this card may go down, the call made or not as the player said (where that is a choice).

WILDconstant

The face code for a Wild card.

WILD_FOURconstant

The face code for a Wild Draw Four card.