本文へ移動

Hitotsu一つ

色か数字をそろえて出し、手札が1枚になったら声をかけます。クラシックやパーティーのルールで、コンピューターや共有のテーブルで遊べます。

「ヒトツ」は「一つ」。手札が1枚になったときに言う言葉です。 名前について(英語)

目次

リファレンス

ゲームとテーブル

import { … } from "@johnmorrisdotca/hitotsu";

最小化と gzip 圧縮をしたサイズは 42.2 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Hitotsu 一つ: a colour-card shedding game for two to eight, with the house rules people actually play.

The core is plain functions over plain data, with no dependency and no DOM: deal, list the legal moves, play one, score the hand, let a computer choose, and keep a game as a line of text. Every function returns a new game and leaves the one it was given alone. The card design is ./card.ts, the table for several devices ./table.ts, and a table to play in any page is mountHitotsu in ./ui/mount.ts, exported here too.

エクスポート

名前種類概要
callMatters関数Whether the call is a choice now: this seat is about to play its second-last card.
cardOfMove関数The card a card move puts down.
colourOf関数A card's colour, or null for a wild.
colourWords関数A colour’s name in English or Japanese.
decodeHitotsu関数Read a saved setup and replay every logged move through the native rules; null for an unreadable, unsupported or illegal saved game.
DRAW_TWO定数The face code for a Draw Two card.
encodeHitotsu関数Save the setup, seed and ordered move log as JSON text; hands and piles are reconstructed when decoded.
faceOf関数A card's face: a digit, or S, R, D, W, F.
freshSeed関数A fresh seed for a new deal.
handOf関数A seat's hand; an empty one for a seat the table does not have.
HITOTSU_CARD_BOX定数The card's width and height in the design's units.
HITOTSU_CAUGHT定数Cards taken for going down to one without calling it, and for a Wild Draw Four challenged and found honest.
HITOTSU_CHALLENGE_LOST定数Cards drawn when a Wild Draw Four challenge fails: six.
HITOTSU_CLASSIC定数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_COLOUR_LOOK定数Each colour's fill, the ink written on it, its element and its name; W is the wilds' and the back's.
HITOTSU_COLOURS定数The four colours in the order a hand sorts them and a picker offers them.
HITOTSU_DECK定数Every card, in the deck's own order.
HITOTSU_DECK_SIZE定数The cards in the deck: 25 in each colour and eight wilds.
HITOTSU_DEFAULT_SIZE定数The default match target, 500 points.
HITOTSU_FACE_MARK定数What each face shows in the middle of a card and in its corners; a number shows itself.
HITOTSU_MOST_PLAYERS定数The most at a table: eight, which one deck of 108 deals seven each and leaves a stock to draw from.
HITOTSU_ONE_HAND定数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_PAPER定数The card's paper, round every card and under the diamond.
HITOTSU_PARTY定数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_POINTS定数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_SIZES定数Supported match lengths: one hand, 200 points or 500 points.
HITOTSU_STRINGS定数Native interface, settings and words for host code.
HITOTSU_STRINGS_JA定数The table's words in Japanese.
HitotsuCard型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.
HitotsuCardMove型A move that puts a card down: in turn, or jumping in.
hitotsuCardShapes関数The shapes of one card, in drawing order: a face, or the back for null.
hitotsuCardSvg関数A whole card as an SVG document, width pixels wide (140/100 of it tall): a face, or the back for null.
HitotsuChallenge型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.
HitotsuColour型A card's colour: red, yellow, green or blue.
hitotsuComputer関数Choose a move for the current player from the legal choices.
hitotsuComputerJump関数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.
HitotsuGame型A GAME OF HITOTSU: its table and moves (what is kept), and the hand they have reached.
HitotsuHandle型Native game access, redealing and presentation updates.
hitotsuJumpIns関数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.
HitotsuLanguage型The languages the table speaks: English, and Japanese ("ja").
hitotsuLanguageOf関数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.
hitotsuMatches関数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.
HitotsuMove型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.
hitotsuMoves関数Every move the player to move may make now; none once the game is over.
HitotsuNews型Something that happened in the last move, for the table to say: nothing a player could not have seen.
HitotsuOptions型How the house plays: each popular variant, as a choice at the set-up.
hitotsuPlayable関数The cards the player to move may play now: on a draw, what stacks; after drawing, the card drawn if it goes.
hitotsuPoints関数What a card left in hand is worth to the player who went out.
HitotsuResult型How a hand ended: who won it and what they scored, or who held least when nobody could go on.
HitotsuShape型One shape of the design.
hitotsuShapeSvg関数One shape as SVG markup.
hitotsuStrings関数The table's words in a language: HITOTSU_STRINGS for "en", HITOTSU_STRINGS_JA for "ja".
HitotsuStrings型Every table word, including embed errors; hosts may override them with strings.
HitotsuTableOptions型Native table settings, including private player names and callbacks.
HitotsuTableSetUp型What a set-up sends beyond a length and the seats: the seed it was dealt from, and the house rules.
hitotsuTop関数The top card of the discard pile.
hitotsuView関数One seat’s hand and legal choices, with public counts and the current colour, for a computer player.
HitotsuView型A COMPUTER AT THE HITOTSU TABLE.
hitotsuWinners関数Once the game is over: whoever went out in a game of one hand; otherwise the highest score, level on it sharing the win.
hitotsuWords関数"red five", "blue draw two", "wild draw four", as a sentence and a screen reader say it; in Japanese, "赤の5", "青のドロー2", "ワイルドドローフォー".
identical関数Whether two cards are the same card to play (the two red fives are).
isDrawCard関数Whether a card makes somebody draw: a Draw Two or a Wild Draw Four.
isHitotsuCard関数Whether an unknown value is an actual physical card id from the deck.
isNumber関数Whether a card is a number, 0 to 9.
isWild関数Whether a card is a Wild or Wild Draw Four.
longestColour関数The colour this hand holds most of, red first among equals so the choice is always the same.
mixSeed関数Two numbers mixed into one seed, so each hand of a game is shuffled from its own.
mountHitotsu関数Put a table of Hitotsu into an element: the person at this screen in seat 0, computers in the rest.
movesFor関数Everything this seat may do now: its own turn's moves, or, at another's turn, the cards it may jump in with.
namedTable関数The game with its seats' names written in, a seat with no name keeping the one it had.
playableFor関数The cards this seat may play now, in turn or jumping in.
playHitotsu関数Apply a legal move and return a new game with that move recorded; null for an illegal move or a finished game.
quickMove関数What a card tapped twice plays: its one way, or null where there is a colour or a seat to choose.
Random型A source of numbers in [0, 1): Math.random, or a seeded one so a deal can be made again.
readHitotsuMove関数A move as something sent it, checked for its shape only: whether it may be made is the rules'.
readHitotsuOptions関数House rules as something sent them, checked for shape, or null.
readTableMove関数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.
readTableSetUp関数The set-up as a device sent it, checked for its shape, jumping in taken off, or null.
reshuffledHitotsu関数These cards shuffled again, the same way for the same seed and salt: a pile turned over to make a new stock.
REVERSE定数The face code for a Reverse card.
SEED_MOST定数The largest seed a deal takes: a whole number that travels in an address or a request as it is.
seededRandom関数A seeded generator (mulberry32): the same seed gives the same numbers, on every machine.
shuffled関数A shuffled copy (Fisher–Yates); the list given is left as it was.
shuffledHitotsu関数The deck shuffled for one hand of one game: the same seed and hand always the same order.
SKIP定数HITOTSU'S DECK, as the rules see it: 108 short names.
sortHitotsu関数A hand as a player holds it: by colour, numbers then actions, the wilds last.
startHitotsu関数Deal a new seeded game for two to eight players at a supported match length; null for an unsupported length or player count.
startTable関数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.
tableComputerMove関数The computer player's move for this seat, or null when the table is not waiting on it.
tableToPlay関数The seat the table waits on, or null once the game is over.
VERSION定数The version of this package, as package.json has it.
waysFor関数The ways this card may go down, the call made or not as the player said (where that is a choice).
WILD定数The face code for a Wild card.
WILD_FOUR定数The face code for a Wild Draw Four card.

ソースを見るGitHub で編集@johnmorrisdotca/hitotsu 1.4.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。