Skip to content

Revanth-144/Wordle-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wordle Solver

A C++ command-line tool that helps solve Wordle puzzles by filtering a dictionary of 5-letter words based on known letter patterns, exclusions, and required letters.

Features

  • Pattern Matching: Input known letters in specific positions (green letters in Wordle)
  • Must-Have Letters: Specify letters that must be in the word but location is unknown (yellow letters in Wordle)
  • Letter Exclusion: Remove words containing certain letters (gray letters in Wordle)
  • Interactive Board: Step-by-step input for letter positions
  • Smart Filtering: Continuously refines word suggestions based on new information
  • Results Limiting: Shows only top 10 suggestions to avoid information overload

Prerequisites

  • C++ compiler with C++11 or later
  • Standard Library support

Setup

  • Place your word list in a file named words.txt in the same directory as the executable
  • The word list should contain one 5-letter word per line (5757 words provided)

Compile the program:

g++ -std=c++11 -o wordle_solver main.cpp

How to Use

Running the Program

./wordle_solver

Interactive Commands

1. Board Setup

  • When prompted, you'll enter known letters position by position:
  • Enter a letter to place it in that position
  • Press Space or Enter to skip the current position
  • Press 1 to go back to the previous position
  • Press 0 to finish board setup early
  • Example board input: [=, =, =, =, =] where = represents empty positions

2. Letter Exclusion

  • When asked "Type in the letters to ignore (if any):"
  • Enter letters that are confirmed NOT in the word (gray letters in Wordle)
  • Separate multiple letters with spaces
  • Example: a b c to exclude words containing a, b, or c

3. Must-Have Letters

  • When asked "Type in the letters to include but not sure of location:"
  • Enter letters that are in the word but position is unknown (yellow letters)
  • Don't separate with spaces
  • Example: ae for words that must contain both 'a' and 'e'

4. Continue Options

  • After seeing results: c → Continue with new board setup (keep current filters) r → Reset everything and start over e → Exit the program

Example Session

[=, =, =, =, =]  
Type letter for position 0 (Space to skip, 1 to go back, 0 to finish): s  
[s, =, =, =, =]  
Type letter for position 1 (Space to skip, 1 to go back, 0 to finish):  
[s, =, =, =, =]  
Type letter for position 2 (Space to skip, 1 to go back, 0 to finish): a  
[s, a, =, =, =]  
Type letter for position 3 (Space to skip, 1 to go back, 0 to finish):  
[s, a, =, =, =]  
Type letter for position 4 (Space to skip, 1 to go back, 0 to finish): e  
[s, a, =, =, e]  
[s, a, _, _, e]

Type in the letters to ignore (if any): r t l n  
Type in the letters to include but not sure of location: i

Here are the results of the matches:
[saice, saide, saige, saize, sajee, sakie, sapie, sasse, saute, savie]

File Structure

  • wordle_solver.cpp → Main program file
  • words.txt → Dictionary file (5757 five-letter words, one per line)

Word List Requirements

  • The words.txt file must:
  • Have one word per line
  • Use lowercase letters only
  • Not contain any empty lines or extra spaces

Tips for Best Results

  • Start Broad: Don't enter too many constraints initially
  • Use Exclusion Wisely: Add gray letters from Wordle to the ignore list
  • Refine Gradually: After each guess, update the board with new information
  • Check All Results: If fewer than 10 words appear, consider all options

Limitations

  • Only works with 5-letter words
  • Requires exact match for known positions
  • Case-sensitive (use lowercase only)
  • No wildcard support for partial matches

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages