Letter Matrix
Interactive letter matrix word search puzzle generator. Find hidden words in a grid of letters with multiple difficulty levels and custom word lists.
About
A letter matrix (word search) embeds n target words into a W Γ H grid of alphabetic characters. Words may run in 8 compass directions: horizontal, vertical, and both diagonals, each potentially reversed. The generator first places words using a backtracking algorithm, then floods remaining cells with uniformly distributed random letters from the English alphabet. Failure to account for placement collisions produces unsolvable or degenerate grids. This tool validates every placement against existing letters before committing, guaranteeing a solvable puzzle for every generation.
Grid density matters. A 10Γ10 matrix with 15 long words will fail to place them all. The tool calculates fill ratio r = total word characters Γ· total cells and warns when r exceeds 0.6. Cognitive research suggests optimal puzzle difficulty sits near r ≈ 0.35 to 0.45, balancing challenge against frustration. Custom word lists accept only alphabetic inputs stripped of whitespace and normalized to uppercase.
Formulas
Word placement validity requires that for each character index i in a word of length L, the target cell coordinates remain within grid bounds and do not conflict with previously placed letters.
coli = col0 + i β dx, rowi = row0 + i β dy
Valid if 0 β€ coli < W and 0 β€ rowi < H and (grid[rowi][coli] = NULL or grid[rowi][coli] = word[i])
The fill ratio measures grid density:
r = nβk=1 LkW Γ H
Where col0, row0 are the starting coordinates, dx and dy are direction deltas (β1, 0, or 1), W is grid width, H is grid height, Lk is the length of the k-th word, and n is total word count. The adjacency check for drag selection uses Chebyshev distance: max(|Ξcol|, |Ξrow|) β€ 1.
Reference Data
| Grid Size | Total Cells | Recommended Words | Max Word Length | Difficulty | Avg. Solve Time | Fill Ratio Target | Directions Used |
|---|---|---|---|---|---|---|---|
| 8Γ8 | 64 | 4 - 6 | 8 | Beginner | 2 - 4 min | 0.30 - 0.40 | H, V |
| 10Γ10 | 100 | 6 - 10 | 10 | Easy | 3 - 6 min | 0.30 - 0.45 | H, V, D |
| 12Γ12 | 144 | 8 - 14 | 12 | Medium | 5 - 10 min | 0.35 - 0.50 | H, V, D |
| 14Γ14 | 196 | 10 - 18 | 14 | Medium-Hard | 8 - 15 min | 0.35 - 0.50 | H, V, D, R |
| 16Γ16 | 256 | 12 - 22 | 16 | Hard | 12 - 20 min | 0.35 - 0.55 | H, V, D, R |
| 18Γ18 | 324 | 14 - 26 | 18 | Expert | 15 - 30 min | 0.35 - 0.55 | All 8 |
| 20Γ20 | 400 | 16 - 30 | 20 | Master | 20 - 45 min | 0.30 - 0.55 | All 8 |
| Direction Key: H = Horizontal, V = Vertical, D = Diagonal, R = Reverse | |||||||
| 8 Compass Directions | |||||||
| Right | dx = 1, dy = 0 | Left | dx = β1, dy = 0 | β β | |||
| Down | dx = 0, dy = 1 | Up | dx = 0, dy = β1 | β β | |||
| Down-Right | dx = 1, dy = 1 | Up-Left | dx = β1, dy = β1 | Diagonal | |||
| Down-Left | dx = β1, dy = 1 | Up-Right | dx = 1, dy = β1 | Anti-diagonal | |||