Skip to the content

Kumimoji組み文字

Build crosswords from seeded English or Japanese tile bags, alone or at a shared table.

Kumimoji means assembled characters in Japanese. About the name

Contents

How-to

Build and judge solo progress

Hold solo progress as a new value, place and move tiles, and check before drawing or finishing.

Keep immutable progress

TilePlay stores the original bag, returned tiles, draw position, hand and grid. placeFromHand, moveOnTable, liftToHand, swapWithHand, draw and trade return progress values. Keep the return value; do not mutate the tiles map to imitate those operations.

import {loadTileWordsFromModule} from "@johnmorrisdotca/kumimoji/words";
import {deal,placeFromHand,judgeWithWords,encodeGrid} from "@johnmorrisdotca/kumimoji";
const words = await loadTileWordsFromModule("english");
let play = deal("catdog",3);
for (let col=0;col<3;col++) play = placeFromHand(play,0,`0,${col}`);
console.log(encodeGrid(play.tiles),judgeWithWords(play.tiles,words).sound);
cat true

Ask before drawing or finishing

mayDraw and isFinished take a native GridVerdict. Every run must be an accepted word and the grid connected; rules can also read diagonals. Use judgeWithWords after changes. A full hand, an invalid grid or an empty bag can change which action is offered. Wild tiles need assigned readings before their runs can be judged.

Keep coordinates and encoding separate

squareAt names integer row/column coordinates, including negatives. encodeGrid trims the occupied bounds and writes a canonical relative shape; it does not preserve how far the table was panned. decodeGrid returns null for an invalid encoded grid. Views covers rotation and zoom without changing rules.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kumimoji 1.6.0.