Wordle solver:   A simple greedy solver for Wordle
guess?
clue/  int?
history?
play
*first-word*
*auto?*
*silent?*
*squares?*
*hard-mode?*
*consistent-only?*
*share-social?*
8.12

Wordle solver: A simple greedy solver for Wordle🔗ℹ

See the README for a quick start and usage examples.

 (require wordle-solver) package: wordle-solver

Note: The interface might change in the future. The documentation below describes only a subset of the exported forms.

procedure

(guess? x)  boolean/c

  x : any/c
A 5-letter word with only alphabetic characters.

procedure

(clue/int? x)  boolean/c

  x : any/c
A number between 0 and 243 (=3⁵).

procedure

(history? x)  boolean/c

  x : any/c
Returns #true if x matches (listof (list/c guess? clue/int?))

procedure

(play target    
  goals    
  all-words    
  [#:history-hash history-hash])  history?
  target : guess?
  goals : (listof guess?)
  all-words : (listof guess?)
  history-hash : hash? = (make-hash)
The main function to play a game, either with user interaction or automatically. Its behaviour depends on several globals described below. all-words must be a superset of goals, and target must be a member of goals.

The globals are also used as command line arguments.

racket -l- wordle-solver --help

outputs:

usage: <prog> [ <option> ... ]

 

<option> is one of

 

  --silent

     Hide most output?

  --no-auto

     In auto mode, the word is guessed automatically; otherwise the user is queried.

  --no-squares

     Print squares instead of letters for clues?

  --share-social

     Display summary to share on social media?

  --first-word <#f>

     First word to play, to speed up computation.

  --target <#f>

     The word to guess. If not provided, clues are asked.

     If 'all', then all words are tried in order, and some statistics are printed.

     If 'random', a word is chosen at random

  --goals-file <goals.txt>, --goals <goals.txt>, -g <goals.txt>

     The file containing the list of valid goal words (one per line).

  --allowed-file <#f>, --allowed <#f>, -a <#f>

     The file containing the list of _additional_ valid guesses. Default: none.

  --cache-file <#f>, --cache <#f>

     File where to load (if exists) and save (at the end of the program)

     the optimal actions for faster decisions in similar circumstances.

/ --consistent-only

|    Allow only guesses that are consistent with all seen clues?

| --hard-mode

\    Play in hard mode?

  --help, -h

     Show this help

  --

     Do not treat any remaining argument as a switch (at this level)

 

 /|\ Brackets indicate mutually exclusive options.

 

 Multiple single-letter switches can be combined after

 one `-`. For example, `-h-` is the same as `-h --`.