Develop your algorithm solving Wordle using this simple test environment.
The colored tiles used as feedback might not be supported by your terminal. If you use Windows please use a windows terminal instead of CMD or PowerShell.
- Clone the repository:
- Run the game to see how it works:
python3 main.py
- Run the test with a simple AI:
python3 main.py --test
- Open the
BadAI.py
file to see how the "AI" works. - Edit it to make it better. You can use the
YourAI.py
as a template, but you have to change theSOLVER
variable inmain.py
to point to AI class. - Run the test with your AI:
python3 main.py --test
- Try to max out the score and have fun!
--test
: Run the test with simple AI.--help
: Show this help.--cases [int]
: Run the test with specified number of cases.--guesses [int]
: Specify allowed number of guesses.--length [int]
: Specify the length of the word.--print [int]
: Specify the print mode (0: no print, 1: print Wordle like boxes, 2: print guesses with feedback, 3: print only test results).
To create your own solution start with YourAI.py
file as a template. It has only three methodes:
Initiates the algorithm. Run only once at the beginning. You can use it to initialize your variables, do some preprocessing, load data, etc.
Parameters:
self
: The object.word_length
: The length of the word to be guessed.guess_limit
: The maximum number of guesses allowed.
Cleans the solver before each game. Use it to reset your variables.
Parameters:
self
: The object.
Asks the solver for the next guess based on the current state of the game.
Parameters:
self
: The object.past_guesses
: A list of past guesses.past_results
: A list of past results*.left
: The number of guesses left.
* See how to interpret the results in Results interpretation.
Result of a guess is always a list of N integers, where N is the length of the word. Meaning of each integer:
- 1: The letter is in the word and in the right position.
- 0: The letter is in the word, but in the wrong position.
- -1: The letter is not in the word.
- -2: Invalid word. It's is not counted as a guess. (the whole list is filled with -2)
This test environment is based on Wordle.
Words come from dataset by Rachael Tatman and are based on Google Web Trillion Word Corpus.
Licensed under the MIT License.
Created by Maciej Gamrot