JP Fosterson

Latest | About

Wordlebrain, a Wordle Cheat Tool

Hard mode is toast.

2022-02-26

It was inevitable, after Wordle swept the word nerds in twitter, the next step would be for it to sweep the math and coding nerds. In the last month the web has been rife with optimality results and other hacks. Here is my contribution.

Wordlebrain is a command-line-based Python program that suggests words to guess by applying the constraints learned from previous guesses, eliminating impossible words, and ranking the remainder by positional letter frequency. It works very well in regular mode and excels in hard mode.

An example game

Below is an example of play using wordlebrain on the Wordle archive game from January 16, 2022.


Screenshot of playing game with word SOLAR.

The Wordlebrain interaction looks like this:

New game.  Wordlebrain recommends starting with CARES.
  wordlebrain> guess cares nyyny
  550 SWART
  545 SPART
  540 SMART
  535 SLART
  535 SKART
  530 STARK
  530 SHARK
  525 STARN
  525 SNARK
  525 SHARN
  ...and 43 more.
  wordlebrain> guess swart Ynyyn
  125 SONAR
  125 SOLAR
  125 SOFAR
  125 SIMAR
  120 SYMAR
  120 SIZAR
  115 SUGAR
  wordlebrain> guess sonar YYnYY
  45 SOLAR
  45 SOFAR
  wordlebrain> 
  

How to use it

  1. Once it’s installed, you run it from a terminal shell with the command $ wordlebrain

  2. Input your guesses like this,

    wordlebrain> guess cares nyyny
      wordlebrain> guess LOUSE nnyny

    Where:

    • n means letter not in word,
    • y means letter in word somewhere,
    • Y means letter in in word at this spot.
  3. Wordlebrain will give a list of suggested guesses like this:

    wordlebrain> guess cares nyyny
      550 SWART
      545 SPART
      540 SMART
      535 SLART
      535 SKART
      530 STARK
      530 SHARK
      525 STARN
      525 SNARK
      525 SHARN
      ...and 43 more.
  4. Choose a guess from the list. Higher ranked guesses will eliminate more choices on subsequent guesses. Use your intuition on whether to choose a high-ranking but perhaps weird word (like SWART), or a lower ranking but more likely word like SMART or STARK or SHARK.

  5. To start a new game, or start over, type reset.

  6. To quit, type quit or exit

Commands

How it works

Wordlebrain has a list of five letter words it uses to start. Each guess’s hints create three kinds of contraints: a five-letter matching pattern, a list of required letters, and a list of excluded letters. With each new guess, wordlebrain merges the new constraints with the existing constraints, applies all the constraints to the word list, and produces a new set of suggestions.

What are those numbers?

Rather than present the suggestions in alphabetical order, wordlebrain gives each word a score designed such that higher scoring words should provide more constraint on the remaining words if applied as the next guess. The score is a the sum of the positional letter frequency of each letter, with a penalty for repeated letters.

Note: the highest scoring suggestion is not necessarily the best suggestion. You will still have to use your judgement to choose a good guess at each step, unless wordlebrain has narrowed your choices down to one word. (It happens!)

See the brain’s state

If you’re curious, at any point you can look at the internal state of wordlebrain with the command showstate. Here is the state from the end of the game above (SOLAR):

wordlebrain> showstate
  == PATTERNS ==
  re.compile('[^C][^A][^R][^E][^S]')
  re.compile('S[^W][^A][^R][^T]')
  re.compile('SO[^N]AR')

  EXCLUDE: {'C', 'E', 'W', 'T', 'N'}
  REQUIRE: {'S', 'A', 'O', 'R'}

To be shown as a suggestion, words must

Guessing Strategy

First Guess: There are many strategies for choosing opening words for Wordle. However, you’re using wordlebrain, I recommend guessing CARES as the first guess. By Wordlebrain’s scoring formula that is the highest scoring word in the word bank, and by experience it seems to eliminate the largest number of options. Several other first guess options also work well: ‘ADIEU’ (vowels), ‘CARET’, ‘RAISE’, ‘TRAIN’, however my experience has been that CARES is the most consistent word for reducing the initial word set.

Second Guess and Later: My strategy for the second guess is to use the top recommended word, unless it seems like a less common word and there is a high-scoring common word visible in the top 10 possibilities displayed. Remember that while there are around 12,000 guessable words, only about 2,500 of those are eligible to be answers. Strange words like SLOPY and SOILY are probably not answers. If I get a list with SOILY at the top and STONY close behind, I might choose STONY instead in the hope that it might be the answer. This strategy applies even more strongly after several guesses when the word list is small. For example, if I get this list of possibilities,

140 STILB
  140 SPILT
  128 STILL
  124 SPILL
  120 SWILL
  120 SKILL
  120 SHILL
  116 STILT

I’d much rather choose any other word in the list than STILB.

That’s it. If you like it or have suggestions, feel free to drop me a line or a tweet.

Share: