リファレンス
ルール・タイル・記録
import { … } from "@johnmorrisdotca/kumimoji";
最小化と gzip 圧縮をしたサイズは 677.3 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Kumimoji 組み文字: the race to build a crossword from a bag of letter tiles, in English or Japanese, alone or at a table of two to eight, as plain functions over plain data.
A game is dealt from a seed (generateKumimoji), so two players racing the
same bag get the same tiles in the same order. The tiles you hold and the
grid you build are values (deal, placeFromHand, draw, trade and the
rest), and every run across and down is judged against a word list
(judgeWithWords, checkKumimoji). A table of players shares one bag
(startParty, endTurn), and a computer player can sit at it
(planComputerTurn). Nothing here touches the DOM or a clock.
The word lists are loaded when first needed: in a browser by
loadTileWords, which fetches them as their own modules; on a server or in
a test through @johnmorrisdotca/kumimoji/words, which reads them from
disk.
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
afterComputerTurn | 関数 | The game a computer's turn passes on: its plan's last step, or the game as it was where there is nothing to play. |
Area | 型 | The squares shown: from top/left, rows by cols. |
arrowStep | 関数 | The step in the grid an arrow key means: the square that way on the screen, with the table turned. |
assignHandTile | 関数 | Give a hand tile its chosen reading, without changing which physical tile it is. |
assignTableTile | 関数 | Give a tile on the table its chosen reading, without changing its square. |
BASE_KANA | 定数 | JAPANESE KUMIMOJI'S TILES ARE THE 45 BASE KANA, and every other kana is one of them played another way. |
bestLaying | 関数 | THE COMPUTER'S NEXT WORD: its play after laying the best word its hand can lay on its table, and the word, or null when there is none. |
Bounds | 型 | The rows and columns a grid's tiles stand within. |
boundsOf | 関数 | The rows and columns the tiles stand within, or null for no tiles. |
checkKumimoji | 関数 | WHETHER A GRID FINISHES A KUMIMOJI: the one check the server also runs. |
COMPUTER_STEPS_MOST | 定数 | The most things a computer does in one turn before pressing Done: at the page's pause, a turn of about three seconds. |
computerName | 関数 | The name a new computer takes: "Computer" and the lowest number no player at the table already goes by. |
ComputerSaid | 型 | What a computer did in one step of its turn, for the line over its table. |
ComputerStep | 型 | One step of a computer's turn: the game after it, and what it did. |
CORNER_FORMS | 定数 | WHAT A TILE SHOWS SMALL IN ITS CORNER: the other ways it is commonly played (John, 2026-09-28: "the tiles like Yu can show the regular and small version in that tile to show its versatility"). |
crossingFit | 関数 | Where word stands with its letter at on the tile at anchor, running across or down, or null where it cannot: a square outside what may be used, a tile at either end, a different letter in its way, a new tile with a neighbour at its side, or no new tile at all — and, given diagonalWord (a game with Diagonals), a new tile standing in a diagonal run of three or more that diagonalWord does not take (diagonalsRead). |
CrossingFit | 型 | A word's place: its first square, and the squares it lays a new tile on, in the word's order. |
deal | 関数 | The opening hand: the first handSize tiles of the bag, and an empty table. |
decodeGrid | 関数 | A grid read back, its first row at row 0, or null for anything that is not one: a stray character, a capital, a grid wider or taller than any grid of fifty tiles can be. |
decodeParty | 関数 | A kept game read back, or null for anything that is not one. |
decodeTileProgress | 関数 | A kept game opened again on its own bag, or null where it does not belong to it: every tile held — hand and table — must be one taken from the bag and not given back. |
DIAGONAL_RUN_LEAST | 定数 | The fewest tiles a diagonal run needs before it is read. |
diagonalsRead | 関数 | Whether every diagonal run a laying's new tiles would stand in is taken by isWord: each walked from its top end down, with the word's own letters on its new squares. |
doneRefused | 関数 | Why Done cannot be pressed now, or null when it can: a hand to trade first, or, for the last one standing, no tile laid on a sound grid yet (a hand already used on a sound grid has nothing left to lay, and wins as it is). |
draw | 関数 | The next tile or tiles out of the bag into the hand. |
drawAll | 関数 | DRAW: every player still in takes one tile, in turn order from the one who pressed it — the race game's rule that when one player uses their hand, everybody draws. |
edgePan | 関数 | Which way, and how far, the table pans this frame for a tile dragged to (px, py): toward the edge it is near. |
encodeGrid | 関数 | A grid as a string, drawn from its own top-left tile: cat/2o/2w. |
encodeParty | 関数 | A table of players as text to keep. |
encodeTileProgress | 関数 | A GAME KEPT half way, as one string (PuzzleRun.progress): how many tiles were taken, the tiles traded back, the hand in its order and the grid (encodeGrid), as 12:q:ae:cat/2o/2w. |
endTurn | 関数 | DONE: the end of a turn, and the device passed on. |
familyKeyOf | 関数 | WHICH TILE OF THE SET A TILE IS, without the word lists: a letter is itself, and any wild — blank or given a face — is the wild. |
fittedMost | 関数 | The largest a fitted tile is drawn in a table this big. |
fitView | 関数 | The view that shows the whole area, centred, its tiles as big as fit between the least and the most. |
formsOfTile | 関数 | Every hiragana a tile plays as, itself first: は is は, ば and ぱ. |
generateKumimoji | 関数 | MAKING A KUMIMOJI, in the browser, from a seed: the bag the game is played from, in the order its tiles come out. |
goesOut | 関数 | Whether the player whose turn it is would go out with Done: their hand used, their grid sound, and too few tiles in the bag for everybody still in to draw. |
GridRules | 型 | How a grid is read: whether its diagonals are (KumimojiOptions.diagonals). |
gridToText | 関数 | A grid as lines of text, the way it lies on the table: English letters in capitals with a space between squares and a dot for an empty one, kana side by side with a full-width dot for an empty one, so that either lines up in a fixed-width face, every row as wide as the crossword. |
GridVerdict | 型 | WHAT IS WRONG WITH A GRID, tile by tile, so the table can mark it: the tiles in a run that is not a word, the tiles not joined to the main grid, and whether the whole is sound — two tiles or more, all joined, every run a word. |
groupsOf | 関数 | The tiles in groups that touch across or down, largest first. |
handCanSpell | 関数 | Whether a hand can spell a word from the list: any word of two tiles or more, a wild counting as able to be anything. |
handSpelling | 関数 | The hand with word's tiles first, in its order, and the rest after them as they were. |
HELP_WORDS_MOST | 定数 | How many words one hand offers before the presses go round again: the longest first. |
holdsItsBag | 関数 | Whether what everybody holds is exactly what was taken from the bag, less what was given back. |
isComputer | 関数 | Whether a computer plays this seat. |
isFinished | 関数 | Whether the game is over: the bag empty, the hand used, and the grid sound. |
isLastTurn | 関数 | Whether the turn now being played is a player's last. |
isOver | 関数 | Whether the game is over. |
isPartyFor | 関数 | Whether a kept game is the one an address asks for: the same settings, and dealt to as many players, whoever has joined or left since. |
JAPANESE_TILE_MIX | 定数 | THE JAPANESE SET: 144 hiragana tiles in 45 kinds (kana.ts), as the English set is 144 letters. |
joinParty | 関数 | A player, or a computer, sat down after the last seat with the next hand out of the bag. |
JoinRefusal | 型 | Why nobody can join now, or null when a hand can be dealt. |
joinRefused | 関数 | Why nobody can join the table now, or null when a hand can be dealt. |
judgeGrid | 関数 | A grid judged against any test of a word: isWord answers for a run as spelt, and readable says how to name one that is not. |
judgeTiles | 関数 | Whether a grid is sound, read against the loaded word list by the game's rules: the same judgement the desk shows. |
judgeWithWords | 関数 | A GRID JUDGED AGAINST ITS LANGUAGE'S LIST, the one way the solo game, each seat of a pass-and-play game and the server's check all ask it: a run is a word when its tiles spell one the list holds (wordOf, so a wild reads as the letter or kana it was given), and a run that is not is named as it reads. |
KANA_TILE_START | 定数 | WHAT A TILE CODE SHOWS, without the word list. |
KANA_WILD_START | 定数 | Where the codes of wild tiles given a kana begin: the kana's place in BASE_KANA above this. |
kanaTileCode | 関数 | The code of a base kana's tile, or of a wild given that kana. |
keepInReach | 関数 | Kept within reach: some of the area always on the screen, so a pan can never lose the crossword. |
KUMIMOJI_BAG | 定数 | SHORT GAME TOTALS, by opening hand. |
KUMIMOJI_CHECK_REASONS | 定数 | Why checkKumimoji will not take a grid, as a stable code and the English clause it says: {name} is a gap the check's values fill. |
KUMIMOJI_DRAW | 定数 | How many tiles one Draw takes from the bag, once the hand is used and the grid is sound. |
KUMIMOJI_EXPORT_FORMAT | 定数 | The shape of the JSON this package writes. |
KUMIMOJI_GRID_MOST | 定数 | THERE IS NO BOARD. |
KUMIMOJI_HANDS | 定数 | THE HANDS, which are the puzzle's sizes: the tiles a game opens with. |
KUMIMOJI_PARTY | 定数 | doubleFrom: from this many players the set-up screen recommends the Double set, and chooses it when the count reaches it (John, 2026-09-28: "when having 6 or more players, we should recommend the double size 288 version"); in Japanese, which has no Double, the Full game instead. |
KUMIMOJI_SCORE | 定数 | WHAT A FINISHED GAME SCORES on its leaderboard, as the other puzzles score theirs (puzzlePoints.ts): ten for every tile laid, and as much again for speed, which falls away evenly until a game that took half a minute a tile earns no speed at all. |
KUMIMOJI_STRINGS | 定数 | The table's words in each language it speaks: KUMIMOJI_STRINGS.en, KUMIMOJI_STRINGS.ja. |
KUMIMOJI_TRADE | 定数 | THE TRADE: one awkward tile back into the bag for three new ones — the classic way out of a hand of Q, X and J. |
KUMIMOJI_VERSION | 定数 | The version of this package, as package.json has it. |
KUMIMOJI_WILDS | 定数 | Wild tiles per original 40/50-tile game, included within the bag total. |
KumimojiCheck | 型 | The answer to "does this grid finish the game?": yes, or no and why, in English (reason) and as a stable code with values a site can say in its own language (KUMIMOJI_CHECK_REASONS). |
KumimojiCheckCode | 型 | A reason checkKumimoji can give, by its stable code. |
KumimojiCheckValues | 型 | The numbers and words that fill a reason's gaps, by the gap's name (see KUMIMOJI_CHECK_REASONS for each code's). |
kumimojiClock | 関数 | A time as minutes and seconds: 1:05. |
kumimojiDailySeed | 関数 | Today's seed, the date as a number: 2026-10-01 is 20261001. |
kumimojiDay | 関数 | The day a moment falls on, in UTC, written YYYY-MM-DD. |
KumimojiDeal | 型 | A GAME DEALT (generateKumimoji): the bag, in the order its tiles come out, as one string of tile codes (* a wild), and one finished grid of those tiles that proves the bag can be finished, never shown to the player. |
kumimojiExported | 関数 | A game as the JSON export's object. |
KumimojiExported | 型 | A whole JSON export of one game: what kumimojiToJSON writes and kumimojiFromJSON reads. |
kumimojiFromJSON | 関数 | A game from JSON that kumimojiToJSON wrote. |
KumimojiLanguage | 型 | The language of the tiles and of the word list they are judged by. |
KumimojiLength | 型 | How much of the set a game's bag holds: a short game, half the set, or all of it. |
KumimojiLevel | 型 | How many of the bag's tiles are wild: easy the most, hard none (KUMIMOJI_WILDS). |
KumimojiLocale | 型 | The languages the table speaks: English and Japanese. |
KumimojiOptions | 型 | WHAT A KUMIMOJI WAS SET UP AS, beyond its hand and level: the choices that make one game a different game from another at the same seed, carried together wherever a game is made, checked, kept or raced. |
kumimojiPoints | 関数 | A finished game's leaderboard points (KUMIMOJI_SCORE): ten a tile, and up to as much again for speed. |
kumimojiRefusal | 関数 | A refusal: { ok: false }, the English reason (the clause of the code with the values in its gaps), the code and the values. |
KumimojiSaved | 型 | A game alone as it is kept: the deal, where the player has got to, and the time spent so far. |
kumimojiSay | 関数 | A line from a table of strings with its braces filled in: kumimojiSay(strings.left, { n: 12, time: "1:05" }). |
kumimojiStrings | 関数 | The table of strings for a locale with a page's own words laid over it. |
KumimojiStrings | 型 | Every word the table shows, by name: one table of these for each language. |
kumimojiTileCount | 関数 | Tile count for a selected length and inventory size. |
kumimojiToJSON | 関数 | A game as JSON, two spaces deep, with the format's number first. |
kumimojiToText | 関数 | A game as plain text, for a chat or a note: how it was set up, the crossword as it lies, the hand, how many tiles are left, and the time. |
kumimojiWildCount | 関数 | Wilds scale with the bag; doubling the tile set doubles the wild count too. |
laidThisTurn | 関数 | Whether the player whose turn it is has laid a tile on their table this turn: more tiles there than when it began. |
lastStanding | 関数 | Whether the player whose turn it is is the only one still in: everybody else has resigned. |
leaveParty | 関数 | A PLAYER LEAVES. |
LeaveRefusal | 型 | Why this player cannot leave now, or null when they can. |
leaveRefused | 関数 | Why the player at seat at cannot leave now, or null when they can. |
LengthRow | 型 | One length of game at one opening hand: how many tiles it deals from one set and from two, and how many of them are wild at each level. |
lengthRows | 関数 | For one opening hand, each length of game: how many tiles it deals, from one set and from two, and how many are wild at each level. |
LENGTHS | 定数 | The lengths of game, shortest first. |
lettersOf | 関数 | How many of each letter. |
liftAll | 関数 | Every tile on the table back to the hand. |
liftToHand | 関数 | A tile on the table back to the end of the hand. |
loadTileWords | 関数 | THE LIST, ONCE. |
mayDraw | 関数 | Whether Draw may be pressed: the hand used, the grid sound, and a tile left to draw. |
mayDrawAll | 関数 | Whether Draw may be pressed: the hand of the player whose turn it is used, their grid sound, and a tile in the bag for every player still in. |
mayResign | 関数 | Whether the player whose turn it is may resign: only once the bag cannot give a trade, so nothing more can be got from it. |
mayTrade | 関数 | Whether a trade may be made: the bag holds as many as a trade takes. |
mayTradeThisTurn | 関数 | ONE TRADE A TURN. |
mixShown | 関数 | A language's set as a page shows it: every tile with its count, the total, and which are the rarest and the commonest. |
MixShown | 型 | A whole set, in its own order (a to z, あ to ん), with what a reader needs to see how uneven it is. |
MixTile | 型 | One kind of tile in a set: the code the game deals, what is printed on it, what shows in its corner, and how many the set holds. |
moveOnTable | 関数 | A tile on the table to another square: to an empty one it moves, onto a tile the two change places. |
mustTradeFirst | 関数 | A HAND THAT SPELLS NOTHING MUST BE TRADED. |
nameOf | 関数 | What a player is called: their name, or "Player 2". |
nextIn | 関数 | The next player still in after from, round the table; from itself when nobody else is. |
nextTurn | 関数 | The next turn a press gives: a quarter clockwise, and four presses back to the start. |
overflows | 関数 | Whether the area, at this view's size, is bigger than the screen: then the table pans. |
panView | 関数 | The view moved by dx and dy screen pixels. |
PartyEnding | 型 | HOW A PASS-AND-PLAY GAME ENDS. |
partyFits | 関数 | Whether a bag of this many tiles can be played by this many: one player can play any bag. |
PartyGame | 型 | A PASS-AND-PLAY KUMIMOJI: one bag, read as a line the way the solo game reads it (TilePlay), and a hand and a table for each player. |
partyLength | 関数 | The game length a set-up plays at: the one chosen where the bag holds this many players, else the shortest that does, so a choice made for fewer players comes back when there are fewer again. |
PartyPlayer | 型 | One player: their name as typed (empty for "Player N"), their hand and their own table, and whether the seat is a computer's (computerTurn.ts), whose turns play themselves in the browser. |
partyPlayersAsked | 関数 | A players count from the address, or 1 (the solo game) for anything that is not two to eight. |
PartySeat | 型 | A seat asked for before the deal or at a join: a name (empty for its number) and whether a computer plays it. |
PartySettings | 型 | What a pass-and-play game was set up as: the address's own choices, which a kept game is matched to. |
partyTilesLeft | 関数 | Tiles still in the shared bag. |
partyTilesNeeded | 関数 | The tiles a bag must hold for this many players: a hand each and one round of draws. |
passViewStart | 関数 | WHOSE TABLE IS SHOWN. |
placeFromHand | 関数 | A tile from the hand onto an empty square. |
placeOf | 関数 | A square's row and column, from its name. |
planComputerTurn | 関数 | A computer seat's whole turn as its steps, in order, for a page to show one at a time. |
Random | 型 | A number in [0, 1), like Math.random, from a stream a seed fixes. |
readSettings | 関数 | A game's settings as something outside this browser sent them — a table on several devices, a kept game — checked, or null. |
readTileProgress | 関数 | The parts of a kept game, or null for a string that is not one: its shape only, with no bag to check it against. |
readTileWordsWith | 関数 | Used by tileWordsModule.ts only: how to read a list where there is no browser. |
readWilds | 関数 | The grid with every blank wild read as a letter that makes all its runs words, or null for none; the grid itself when it holds no blank. |
resign | 関数 | RESIGN: the player whose turn it is is out of the game, their table kept for the finish, and their turn passed over from then on. |
Run | 型 | A run of tiles along one line: the word it spells and the squares it stands on, in reading order. |
RunLine | 型 | THE LINES A RUN MAY LIE ALONG, each read top to bottom (and across, left to right): across and down always, and the two diagonals when the game was set up with Diagonals — down to the right, and down to the left. |
runsOf | 関数 | Every run the grid is read by: two or more tiles across, then down, and with Diagonals three or more down to the right, then down to the left. |
sameLetters | 関数 | Whether two tallies hold the same letters, as many of each. |
seatPlay | 関数 | The player whose turn it is, as the solo game's moves take a game: the shared bag, and their own hand and table. |
seededRandom | 関数 | A stream of numbers in [0, 1) that the seed fixes: mulberry32. |
shuffled | 関数 | A copy of the list in a random order (Fisher–Yates). |
sortHand | 関数 | The hand in order (John, 2026-09-28: "it gets sorted for letters alphabetically"): English A to Z, Japanese あいうえお, which is the order of the kana's tile codes, and the wilds last as they came. |
Square | 型 | A square by its row and column. |
squareAt | 関数 | A square's name, "row,col". |
squareUnder | 関数 | The square under a point on the screen. |
startParty | 関数 | The deal: each player the next hand from the bag in turn, player one first, and every table empty. |
stepView | 関数 | The player a swipe or an arrow shows next: by seats on, round the table. |
stillIn | 関数 | The players still in — not resigned — by place, in turn order. |
swapWithHand | 関数 | A tile from the hand onto a square that holds one: they change places, the table's tile going to the hand where the other was. |
TABLE | 定数 | HOW THE TABLE IS LOOKED AT: which squares are shown, how big a tile is drawn and where. |
tableArea | 関数 | The squares to show: the tiles' extent and the margin, or the margin round square (0, 0) on an empty table. |
tableTally | 関数 | A table's tiles as one string in order, wherever they stand: what a turn compares to see whether anything was laid or lifted. |
tidyName | 関数 | A name as kept: trimmed, one line, and no longer than a line holds. |
TILE_MIX | 定数 | THE MIX: how many of each letter a full set holds, 144 tiles in all. |
TILE_MIX_TOTAL | 定数 | The whole set, counted from the table. |
tileDescription | 関数 | What a screen reader says for a tile: its letter, or that it is a wild and what it stands for. |
tileFace | 関数 | What a tile code shows, read without the word list: its letter or kana, its corner forms, and whether it is a wild. |
TileFaceOf | 型 | What a tile shows: what tileFace answers. |
tileKana | 関数 | The tile a kana is played with, or null for anything that is not hiragana (ー, katakana, a letter). |
TilePlay | 型 | A KUMIMOJI BEING PLAYED: the bag, the tiles traded back into it, how many have been taken out, the tiles on the table and the hand. |
Tiles | 型 | A KUMIMOJI GRID: letter tiles on a table with no edges. |
tilesHeldBy | 関数 | How many tiles a player would put back in the bag by leaving: their hand and their table. |
tilesLeft | 関数 | How many tiles are still in the bag. |
tileWords | 関数 | The list already loaded, for judging and dealing. |
TileWords | 型 | KUMIMOJI'S WORD LIST, loaded once, when a game opens. |
tileWordsFrom | 関数 | A list read from its module, for tileWordsModule.ts. |
tileWordsReady | 関数 | Whether the list has been fetched yet, for a page to say "loading" rather than throw. |
trade | 関数 | One tile from the hand to the bottom of the bag, and the next three out of it. |
tradeChoice | 関数 | The tile a computer trades: its rarest letter in the set, the first of those in its hand; never a wild. |
TRY_IT | 定数 | THE TRY-IT ON THE FRONT DOOR: a Kumimoji of ten tiles, played in the reader's browser with the game's own moves and the game's own word check. |
Turn | 型 | How far the player has turned the table to look at it: quarter turns clockwise, 0 to 3. |
turnArea | 関数 | The squares a turned table shows: the grid's area, turned. |
turnPlace | 関数 | Where square (row, col) of the grid is drawn with the table turned: a quarter clockwise sends a word running right to one running down, and one running down to one running left. |
turnView | 関数 | A view the player zoomed or panned, turned a quarter clockwise with the table about the middle of its box: the same zoom, and the spot of the table that was in the middle stays there. |
typingWay | 関数 | Which way typed letters run ON THE SCREEN. |
unpackLength | 関数 | Front-coded words of one length read back (see scripts/tile-words.mjs): a shared-prefix character, then the rest. |
unpackTileWords | 関数 | The English list read from its packed data: every word, the words by length, the set's mix, and the functions that turn tiles into words. |
unturnPlace | 関数 | The grid's square drawn at (row, col) of the turned table: turnPlace undone. |
View | 型 | A view: a tile's side in pixels, and where the corner of square (0, 0) is drawn. |
WILD_SEARCH_MOST | 定数 | A WILD LAID WITHOUT A LETTER READS AS WHATEVER MAKES THE GRID WORDS. |
winnersOf | 関数 | The winners of a finished game, by place: everybody who went out; the last one standing; or, tied, the final run of resignations. |
withSeatPlay | 関数 | A move made on seatPlay put back: the bag as it left it, and the hand and table to the player whose turn it is. |
wordsInHand | 関数 | The words the hand's own tiles spell, longest first and then in the list's order; wilds are not used. |
zoomView | 関数 | Zoomed by factor about the point (px, py) on the screen, which stays over the same spot of the table. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。