Letter Boxed
Puzzle solver and visualizer for NYT’s Letter Boxed
It started as a Java project for CS 112 in Spring 2022. A summer rewrite moved the recursive backtracking solver to TypeScript, added a React frontend to visualize it, and deployed it to GitHub Pages.
The solver did all its work on the client, and heavy puzzles would freeze the UI. Fixing that took a few iterations: first the algorithm moved to a Google Cloud Function (which stopped the freezing but added network latency), then that function was rewritten in Go to bring latency back down. Eventually it came home to the client for good — running in a Web Worker so the heavy computation never blocks the interface.
The current version leans into that client-side approach. The solver tracks a puzzle’s twelve letters as a 12-bit bitmask, so checking whether a word chain uses every letter is a single bitwise comparison; it precomputes letter adjacency and filters the ~26K-word dictionary down to the few hundred words a given puzzle allows before searching. Solve returns the first valid answer, while Find Best searches for the optimal one — fewest words, then shortest total length — offloading that heavier combinatorial search to the GPU via WebGPU compute shaders that extend word chains in parallel across multiple passes, with a CPU fallback. A slider steps through each stage of the solution, and a generator produces random puzzles weighted by English letter frequency.
Tech stack: React, TypeScript, Tailwind v4, shadcn/ui, Zustand, Vite, WebGPU (WGSL), Web Workers, Bun, Vitest.