Wordle Bot
RepositoryI developed this high-performance Wordle tool to explore frequency-based heuristics and game theory in a CLI environment. The project includes a fully playable terminal version of the game and a sophisticated solver that uses weighted letter analysis and pattern filtering to identify the optimal next guess. It served as a practical application for Rust's string manipulation and collection handling.
Iterative Solver Loop
The heart of the solver is a state-driven loop that guides the user through the elimination process. It captures the user's guess and the corresponding feedback pattern—where c represents a correct position, m a misplaced letter, and w a wrong letter. By using io::stdin and io::stdout, I created a seamless interactive experience that updates the word pool in real-time based on the provided constraints.
Heuristic Filtering Engine
The core filtering logic is implemented in the filter.rs module. It uses a series of predicate functions to prune the word list after each guess. The engine checks for strictly forbidden characters, enforces correct positions, and validates misplaced letter constraints using a HashSet for efficient lookups. This allows the solver to reduce a list of 12,000+ potential words down to just a handful of candidates in mere microseconds.
Terminal Rendering and ANSI Colors
To provide a visual experience consistent with the original game, I implemented a terminal renderer that uses ANSI escape codes. The print_summary function displays the board with color-coded backgrounds—green for correct, yellow for misplaced, and gray for incorrect letters. This ensures that the CLI version of the game is not only functional but also visually intuitive, complete with a dynamically updated virtual keyboard.
Strategy Simulation
Beyond simple solving, the tool features a simulation engine that allows for testing different starting words against the entire dictionary. By analyzing the average number of guesses required to reach the target, I was able to identify high-performing opening words like CRANE or SLATE. This project provided valuable insights into combinatorics, algorithmic efficiency, and the power of Rust for CLI utility development.
Try It Out
DownloadTo run the bot from your terminal (Command Prompt or PowerShell), navigate to the folder where you downloaded the file and type: wordle-bot.exe