← Back to projects

Wordle Solver

A Python CLI that solves NYT Wordle with letter-frequency heuristics and regex filtering. Averages 3.79 guesses across 1,062 historical puzzles at a 97.9% win rate.

Tool·complete·October 2022
Wordle Solver

A command-line Wordle solver built in a 12-hour session. It ranks all 8,000+ five-letter English words by letter frequency, then filters the remaining solution space with regex after each guess. No machine learning and no information theory: frequency analysis and elimination only.

How It Works

  1. Word scoring: every five-letter word is pre-ranked by the sum of its unique letters' frequencies across the whole word list. The opener RATES ranks first.
  2. Guess and filter: color feedback (green, yellow, gray) drives regex elimination of impossible words, including correct handling of duplicate letters.
  3. Greedy selection: the solver takes the highest-ranked remaining word. No lookahead, no entropy calculation.

Benchmarked Performance

Tested against all 1,062 historical NYT answers:

Metric Result
Average Guesses 3.79
Win Rate 97.9% (1,040 / 1,062)
Losses 22 words required 7 guesses
Most Common Result 4 guesses (38.5%)

Guess distribution:

Guesses Count Share
2 61 5.9%
3 357 34.3%
4 400 38.5%
5 180 17.3%
6 42 4.0%

How It Compares

Solver Avg Guesses Win Rate Approach
Optimal (decision tree) 3.42 100% Full lookahead tree search
3Blue1Brown (entropy) 3.43 100% Greedy Shannon entropy
NYT WordleBot ~3.48 100% Heuristic evaluation
This solver 3.79 97.9% Letter frequency + regex
Average human player 3.80 ~98.6% Intuition + vocabulary

The solver performs at human level, 0.37 guesses behind the mathematical optimum, on letter frequency and pattern matching alone. The 2.1% failure rate comes from words with uncommon consonants or repeated letters, where frequency heuristics stall.

Modes

  • Live assist: solve_game.py runs alongside the real NYT puzzle. Enter feedback, get the next suggestion.
  • Batch benchmarking: solve_on_answer_list.py measures performance against any word list at scale.
  • Playable game: game.py plays a full round locally, with debug levels that reveal hints, suggestions, or the answer.

Usage

# Play a round
python game.py

# Get solver assistance for a live puzzle
python solve_game.py

# Test the solver on a specific word
python solve_on_answer.py crane

# Benchmark against historical answers
python solve_on_answer_list.py