Basic Usage

Much of wordle_boss’s functionality is contained within the Solver class, which can be used like this:

>>> import wordle_boss as wb
>>> from wordle_boss.names import *
>>> # Create a Solver with the list of most common 5-letter words:
>>> s = wb.Solver(wb.get_word_list(SHORT_LIST))
>>> # No guesses have been added so far, so this will get the best first guess:
>>> s.best_guess()
'RAISE'
>>> # Add a guess with the first three letters gray and the last two yellow
>>> s.add_guess(
...     "STARE",
...     [
...         FB_ABSENT,
...         FB_ABSENT,
...         FB_ABSENT,
...         FB_PRESENT,
...         FB_PRESENT
...     ]
... )
>>> # Best second guess in this situation:
>>> s.best_guess()
'PRIOR'
>>> # Best second guess in "hard mode", where each guess must incorporate all
>>> # the information from previous guesses:
>>> s.best_guess(hard_mode=True)
'DECOR'

In general, to use this package:

  1. Get a word list to use (or two, one of guesses and one of possible target words) using get_word_list(), normally passing it either SHORT_LIST or LONG_LIST.

  2. Create an instance of the Solver class, passing it the word list(s).

  3. Add guesses using Solver.add_guess().

  4. Get all possible remaining target words using Solver.get_possibilities().

  5. Get the best next guess according to the MINIMAX algorithm using Solver.best_guess().