本文へ移動

Kumimoji組み文字

シードから配った英字やかなのタイルで、ひとりでも複数人の卓でも、単語を組み合わせて遊べます。

「組み文字」は文字を組み合わせることを表す言葉です。 名前について(英語)

目次

リファレンス

ルール・タイル・記録

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.

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

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