Grandma vs. Data Scientist Student: Information-Theoretic Wordle Solver
April 2025 - Present
About This Project
This project is an intelligent Wordle solver that uses information theory and optimization algorithms to play the New York Times Wordle game with high accuracy and efficiency. It models each guess as an information-gathering step, selecting words that maximize expected information gain and minimize the number of guesses needed to find the correct answer. I originally built it to compete playfully with my grandmother, a retired English professor and lifelong word-game enthusiast, and it has become a fun way for us to connect, compare strategies, and talk about language from two very different perspectives: hers as a human expert in words and mine as a data science student building algorithms.
Project Details
The core of the system is a data-driven optimization engine that treats Wordle as a sequential decision-making problem under uncertainty. The model: - Uses Shannon entropy to score each possible guess based on how much information it is expected to reveal about the hidden word. - Maintains and updates a candidate set of valid answers after every guess by matching the observed color pattern (green, yellow, gray) against all remaining words. - Combines multiple signals, including entropy, pattern consistency, letter-position frequencies, and a minimax-style worst-case score, into a single weighted score for each candidate guess. To validate the approach, the optimizer was tested against 1,355 historical Wordle answers. It achieved a 98.3% win rate with an average of 3.57 guesses per solved game, and solved 84% of games in 3–4 guesses. The remaining difficult cases tend to be words with rare letter patterns or high ambiguity across multiple candidates. Beyond the optimization engine, the project includes a Selenium-based automation layer that plays the game directly on the NYT website. This layer: - Launches a headless browser, handles cookies and modals, and interacts with the on-screen keyboard. - Sends each model-generated guess to the game and reads back the resulting color pattern from the board. - Logs each game with both technical explanations (entropy, candidate reductions) and simple language explanations of why each guess was chosen. The logging format is intentionally split into a "data scientist" view and a "grandma" view: one focuses on bits of information, probability updates, and search space size, while the other explains in plain language which letters we learned about and why the next word makes sense. This makes it easy for my grandmother to follow the model’s reasoning and has turned the logs into a shared artifact we can read together and discuss after each game. Overall, the project showcases how concepts from information theory, probabilistic reasoning, and algorithm design can be used to build an end‑to‑end, automated game-playing system with measurable performance. Limitations While the optimizer achieves strong performance with a 98.3% win rate, there are several limitations to consider. The scoring weights (40% entropy, 20% pattern matching, etc.) are manually tuned and may not be optimal for all game states. The current implementation uses a greedy approach without deep lookahead, which can struggle with words that require strategic multi-move planning. Some failure cases involve unusual letter combinations (like "uvula", "kazoo", "snafu") that don't follow common English letter frequency patterns, or ambiguous words that share similar patterns with many other candidates. The system also doesn't learn from past games or adapt its strategy based on historical performance. Additionally, entropy calculations can be computationally expensive in early game states with many remaining possibilities, though multiprocessing helps mitigate this. Next Steps Future improvements planned for this project include implementing dynamic weight tuning using machine learning techniques to automatically optimize scoring weights based on game outcomes (Some of which I'm learning this year at university with my Machine Learning course). A minimax algorithm with configurable depth would enable deeper lookahead for challenging words that require strategic planning. Adding a learning component that learns from historical games could improve word selection, potentially using neural networks or decision trees. Performance could be enhanced through GPU acceleration for parallelizing entropy calculations, and more sophisticated caching strategies that persist across games. Additional features could interactive visualizations showing entropy calculations and decision trees, and comparative analysis tools to test different optimization strategies. Research directions include deeper analysis of failure cases to identify common patterns, exploration of alternative optimal starting words, and development of predictive models that estimate solve probability based on word characteristics.
Technologies
Project Information
Category
Algorithms & Optimization
Timeframe
April 2025 - Present