What it does
A generated board starts from two words: a first word, and a second that begins with its last letter, which between them use exactly the box's letters. The pack shares those letters out among the sides so that neither word ever takes two letters in a row from one side, then shuffles them. So every board it makes has a two-word answer, and a board that one long word clears on its own is passed over unless you ask for it.
Play is a chain. A word is typed or traced as board indices, and it is refused, with the reason, when it is too short,
uses a letter not on the board, takes two letters in a row from one side, starts with the wrong letter, is not a word
or has been played. observation() gives the sides, which letters are used, the words played, the letter the next
word must start with, and the par.
The solver searches breadth first over the letters used and the last letter, through every word that fits the board, so the par, the hint and the full solution are the fewest words, not a guess. Every board is a seed and a list of words on the kernel history, so undo, saves and a daily board come with it.
Features
- Seeded boards — the same seed always makes the same board, for a daily puzzle.
- A two-word answer — every generated board can be cleared in two words, and
minParkeeps out one-word boards. - Any box — three sides or six, two letters a side or four, up to 26 letters.
- Exact rules — never two letters in a row from one side, each word from the last one's end, every letter used.
- Readable refusals — "R and I are on the same side.", "Start with T.", each fit to show a player.
- Typed or traced — a word as text or as board indices from a drag.
- Par, hints and a solution — the fewest words, from the start or from where the player is.
- Set boards — any sides of distinct letters, checked.
- Undo and saves — the kernel history of words played.
Good for
- A daily letter box, one seed for every player and a par to beat.
- Bigger and smaller boxes, a triangle of threes or a hexagon of fours for a different challenge.
- Short-word boards, a pentagon of pairs with four-letter words and a three-word goal.
- Hand-made puzzles, a set board with a theme in its letters.
- Word game collections, beside wheels, grids and guessing games.
Make it yours
A board takes sides, perSide, minLength, maxWords (the goal), minPar, the words that count, a set board
and the generation attempts. The pack draws nothing, so the box, the letters and the chain are yours, or
letter-tiles draws them.
Two different boards from the same pack: the classic four sides of three letters with a five-word goal; and a pentagon of two letters a side, four-letter words only and a three-word goal. A third is a set board from a hand-picked word pair.
A quick look
A board, a word and a hint:
const box = createLetterBox({ seed: day }); // four sides of three, solve in five words
const view = box.observation(); // sides, letters used, words, start letter, par
box.check('right'); // { ok: true } or { ok: false, reason }
box.play('right'); // or box.trace([indices]) for a traced word
box.hint(); // { word, remaining }: the next word of a shortest finish
Works with
english-words— required: the words that count, and the lists boards are built from.letter-tiles— draws the letters round the box, keeps a drag off the last letter's side and keeps each word drawn.letter-wheel— when one word's letters should spell many words instead.
Good to know
- It is the rules only: the game draws the box and turns pointer positions into board indices.
- The solver prefers long words, and the lexicon has some uncommon ones, so a hint may be a word few players know; a filtered word list keeps them out.
- The solver gives up past a few hundred thousand states, so a hand-set board that needs many words may show no par.
- A word cannot be played twice; letters can be used again and again.






