A Python Wordle project with a naive heuristic solver, interactive UI, and benchmark tooling.
- Naive heuristic word guessing using letter frequency and elimination
- Interactive Streamlit web UI with color-coded feedback
- Real-time confidence tracking and word possibility updates
- Automated benchmark runner with notes and "hard"-word reporting
- Python 3.7 or higher
- pip (Python package manager)
- Clone or download the repository
- Navigate to the project directory
- Install dependencies:
pip install -r requirements.txtRun the Streamlit interface for an interactive, user-friendly experience:
streamlit run wordle_ui.pyThis will open a web browser at http://localhost:8501 with an interactive interface where you can:
- See the suggested word displayed as large tiles
- Click color buttons (⬜🟨🟩) to provide feedback
- Watch real-time updates on confidence and remaining possibilities
- Track your game history
- Choose solver mode (
naiveortrained) from the dropdown
For the naive command-line solver:
python naive/wordle_solver.pyThen follow the prompts to enter feedback as:
- 0 for Grey (not in word)
- 1 for Yellow (wrong position)
- 2 for Green (correct position)
Run the benchmark to evaluate solve rate across the dictionary:
python benchmark_solver.pyUseful options:
python benchmark_solver.py --num-seeds 10 --seed-start 0
python benchmark_solver.py --word-limit 500 --sample-failed 20
python benchmark_solver.py --json-out benchmark_results.jsonWhat this does:
- Simulates full games automatically (no manual input required)
- Computes solve rate, average turns, and failed-word list
- Finds hard words across multiple random seeds
- Overwrites
notes/notes.mdwith the latest benchmark summary on every run
You can benchmark either solver type:
python benchmark_solver.py --solver naive
python benchmark_solver.py --solver trained --model-path trained/trained_strategy.jsonTrain a lightweight linear strategy model (no external ML libraries required):
python trained/train_strategy_model.pyUseful options:
python trained/train_strategy_model.py --iterations 200 --train-size 600 --eval-size 300
python trained/train_strategy_model.py --out trained/trained_strategy.jsonThis creates trained/trained_strategy.json containing learned weights and train/eval metrics.
naive/wordle_solver.py: baseline naive heuristic solvertrained/trained_solver.py: trained strategy model solvertrained/train_strategy_model.py: training script for model weightstrained/trained_strategy.json: trained model weightsbenchmark_solver.py: benchmark runner for both solver modesnotes/: benchmark notes and run summarieswordle_ui.py: Streamlit app with solver mode selector
The current solver is intentionally naive (heuristic, not trained).
- Choose a guess from the current candidate list.
- Receive feedback as a 5-digit code:
2= green (correct letter, correct position)1= yellow (correct letter, wrong position)0= grey (not present, accounting for duplicate-letter counts)
- Filter candidate words to only those that would produce exactly the same feedback for that guess.
- Repeat for up to 6 turns.
- Early turns (0-1): frequency-biased probing.
- Later turns: choose from narrowed candidates.
- Repeated guesses are avoided.
The trained solver uses a small linear scoring model over handcrafted features.
Features per candidate guess:
- Unique-letter frequency score from remaining candidates.
- Positional letter-frequency score.
- Bonus for letters not yet seen in prior guesses.
- Bonus if the word is still in the candidate answer pool.
- Penalty for duplicate letters.
During training, random search mutates these feature weights and keeps models that improve solve rate and average turns on a training subset.
Green - Correct Position
Yellow - Wrong Position
Grey - Not in Word
In the above image, the corresponding feedback would be: Yellow-Grey-Grey-Grey-Grey
In the above image, the corresponding feedback would be: Yellow-Yellow-Green-Grey-Grey
The solver typically finds the answer within 4-6 attempts, with high confidence by turn 3-4.
MIT

