An intelligent Wordle solver that uses letter frequency analysis to crack any Wordle puzzle efficiently. This program analyzes a database of all valid Wordle answers and guesses to systematically solve puzzles in an average of ~4.5 attempts.
The bot uses a three-step strategy to find the optimal solution:
- Filter - Narrow down possible guesses using clues from the previous guess
- Rank - Score remaining words using letter frequency analysis
- Guess - Select the highest-scoring word as the next guess
This process repeats until the correct word is found.
The bot supports two different scoring methods that you can choose from:
Uses overall letter frequency across all Wordle answers. This method considers how often each letter appears in the entire word list, regardless of position.
Analyzes letter frequency by position in the word. For example, 'S' is most common in position 1, while 'E' is most common in position 5. This method provides more accurate predictions by accounting for letter placement patterns.
Performance: Method 2 achieves an average of 4.55 tries across 1000 test games with a maximum of 11 tries.
The notebook provides several ways to use the bot:
Help solve a real Wordle puzzle interactively:
solve(method=2)Usage:
- Enter your first guess (or press Enter to use the bot's suggestion)
- After each guess, enter the clues from Wordle as a 5-digit number:
0= Grey (letter not in word)1= Yellow (letter in word, wrong position)2= Green (correct letter, correct position)
- The bot will suggest the best next guess
- Type
quitto exit
Example:
Enter first guess: slate
Enter clues: 01020
Best Guess: crate
Test the bot's performance on random Wordle puzzles:
# Single game with display
runWordle(numTimes=1, display=True, method=2)
# Batch testing (1000 games)
triesLog = runWordle(1000, display=False, method=2)
analyze(triesLog)Parameters:
numTimes: Number of games to simulate (default: 1)display: Show step-by-step output (default: True)firstWord: Specify a custom starting word (default: bot's best guess)method: Choose scoring strategy - 1 or 2 (default: 2)
After running batch tests, use the analyze() function to see statistics:
analyze(triesLog)This displays:
- Mean number of tries
- Standard deviation
- Min/max attempts
- 25th, 50th, and 75th percentiles
- Python 3.x
- NumPy
- Pandas
- Jupyter Notebook (to run the .ipynb file)
- Clone this repository:
git clone https://github.com/jaimanm/wordle-bot.git
cd wordle-bot- Install dependencies:
pip install numpy pandas jupyter- Launch Jupyter Notebook:
jupyter notebook wordle.ipynbThe bot uses two data files located in wordle_data/:
wordle-answers-alphabetical.txt- Complete list of valid Wordle answerswordle-allowed-guesses.txt- Extended list of acceptable guess words
The bot's intelligence comes from:
- Frequency Analysis: Pre-computed letter frequency tables for each position
- Smart Filtering: Efficient elimination of impossible words after each clue
- Duplicate Handling: Penalty system for words with duplicate letters to maximize information gain
Based on 1000 simulated games using Method 2:
- Average: 4.55 tries
- Median: 4 tries
- Success Rate: 100% within 11 tries
- Within 6 tries: ~98% (standard Wordle limit)
This project is available for personal and educational use.
Created by Jaiman Munshi
Visit my personal website to see more projects!