Back to Projects
Algorithms & Optimization

Provably Optimal Wordle Solver

April 2025 - October 2026

About This Project

A Wordle solver in two versions, and a bot that plays the New York Times daily puzzle with it. Version 1 picked the guess with the highest expected information gain and solved about 98% of games, but was not provably optimal. Version 2 runs a branch-and-bound search over the whole decision tree: it solves the 2,315 original answers in 7,920 guesses (3.4212 on average), the proven minimum, and is tied for first of 942 entries on the Wordle bot leaderboard. I originally built it to compete playfully with my grandmother, a retired English professor and lifelong word-game enthusiast.

Project Details

I built this solver to compete playfully with my grandmother, a retired English professor and lifelong word-game enthusiast. It has had two versions. Version 1: maximize information (2025) - Scored each guess by its expected information gain (Shannon entropy), combined with letter-position frequencies and a worst-case score in a hand-tuned weighting. - Tested on 1,355 historical answers: 98.3% of games solved, 3.57 guesses on average. - It was greedy: it chose the best next guess without looking further ahead, so it was not provably optimal, and it lost on words such as "uvula", "kazoo" and "snafu". Version 2: search the whole decision tree (October 2026) - A strategy is a decision tree: a guess, then for every color pattern, the next guess. Version 2 searches for the tree with the fewest total guesses. - The search is a depth-first branch-and-bound over an AND-OR tree, with results memoized per set of remaining answers, an admissible lower bound to prune guesses that cannot win, and the subtrees under the opening word solved in parallel. - Result on the 2,315 original answers: 7,920 guesses in total, 3.4212 on average, never more than 5, opening with SALET. - 7,920 is the proven minimum for these word lists (Bertsimas & Paskov, "An Exact Solution to Wordle", Operations Research 2025), so the tree is optimal. - On the Wordle bot leaderboard, it is tied for first place: none of the 942 entries is lower. - The tree is built in about 7 seconds on an 18-core laptop, and the tests compare the search against brute force on small word sets. The daily bot A Selenium bot plays the New York Times puzzle in Chrome every day and logs each game. Because the Times has added answers that are not in the original lists, the bot plays a second tree built on every word the Times accepts. On every real answer through October 2026 (1,920 games) it averages 3.4526 guesses with no losses.

Technologies

PythonNumPyBranch and BoundDynamic ProgrammingInformation TheorySeleniumOptimization

Project Info

Category

Algorithms & Optimization

Timeframe

April 2025 - October 2026