This Python script provides a solver for the game Wordle. Wordle is a word puzzle game where players try to guess a hidden word by submitting guesses, and receiving feedback on the correctness of their guesses.
This solver script aims to efficiently guess the hidden word by analyzing feedback from previous guesses and narrowing down the possibilities based on the given constraints.
- WordleSolver Class: Defines a WordleSolver class that encapsulates the logic for analyzing feedback and generating the next guess.
- Play Function: Includes a function
playOnceto play the game once, providing the hidden word and optionally the starting word. - Evaluation Function: Provides a function
evaluateModelto evaluate the performance of the solver by playing the game multiple times.
- Python 3.x
- pandas library
-
Clone the Repository: Clone this repository to your local machine.
git clone https://github.com/ArthurrMrv/WordleSolver.git
-
Install Dependencies: Install the required dependencies using pip.
pip install pandas
-
Run the Script: Run the script and start playing Wordle!
python wordle_solver.py
-
Optional Configuration: You can configure the solver by modifying the parameters in the
WordleSolverclass constructor or by passing arguments to theplayOnceorevaluateModelfunctions.
# Import the WordleSolver class and utility functions
from wordle_solver import WordleSolver, playOnce, evaluateModel
# Create a WordleSolver object
solver = WordleSolver()
# Play the game once
playOnce(wordToFind="apple")
# Evaluate the solver's performance
score = evaluateModel(iters=100, wordToFind="banana")
print("Average score:", score)Contributions are welcome! If you'd like to improve the solver or add new features, feel free to submit a pull request.