Three Wordle Assistants

When I tackle a Wordle puzzle, I like to make all the key decisions myself. My three assistants set up puzzles and suggest words when I ask for help, but I guide the actual solution. My assistants also make it possible for me to play Wordle anywhere, anytime, even when my laptop is in airplane mode. I don't need the New York Times or access to the Web.

Contents

Three Assistants

Wordler, Words and Wordie are the three assistants. Wordler replaces the Times by generating puzzles and evaluating responses. Words provides lists of possible responses. Wordie handles the Wordler Window and colors the letters gray, green or gold.

Vocabulary

Words has a vocabulary of 4665 five-letter English words. Any of them are acceptable responses. The vocabulary begins with

  vocab = [ ...
  "ABEAM" "ABETS" "ABHOR" "ABIDE" "ABLED" "ABLER" "ABODE" "ABORT" ...

And, 584 lines later, ends with

  "ZILCH" "ZINCS" "ZINGS" "ZIPPY" "ZOMBI" "ZONAL" "ZONED" "ZONES" ...
  "ZOOMS" ];

If you were to print the entire vocabulary with 40 lines per page, you would print over 100 pages of words.

Words

It took me a long time to write the Words assistant, which is called whenever the Words button in the Wordle Window is clicked.

Words is supported by a seventeen-program library of functions named Wordspq where p and q are nonnegative integers with p+q <= 5. Wordspq finds words with p green letters and q gold letters. The programs in the Words library all have the same structure involving five nested for loops.

The last line of Words is

  feval(['Words' p q],Gray,Green,GreenLoc,Gold,GoldLoc)

Gray, Green and Gold are lists of letters with specified colors and with locations GreenLoc and GoldLoc. Locating the green letters is easy because they must be in specific slots. Locating the gold letters is tricky because each of them can be in any of several different slots.

For example, this situation in the NYT puzzle described below would result in a call to Words13 with

  Gray = 'AIHEC'
  Green = 'T'
  GreenLoc = 5
  Gold = 'ROU'
  GoldLoc = {[2,3],[3,4],[1,2,4]}

Wordle

Wordle starts a game by choosing a secret random target from the vocabulary, or from a smaller subset about half the size. At the same time, I choose my starting word, which is usually RATIO. My assistants respond with the Wordler Window and a simple keyboard.

The gold O tells me the target contains an O, that it is not in position 5, and the target does not contain R, A, T, or I. I know there are hundreds of such words in the vocabulary. One of them is DEMOS, which I enter on the keyboard.

DEMOS happens to be a very lucky choice. The target has an E in the second slot, an S in the last slot, M and O in the remaining slots, and no D. When the answer does not occur to me in a minute or two, I click the Words button. The response is

  MEOWS
  cnt = 1

So, there is only one word to choose, and it earns five greens.

NYT

Let's do the Times puzzle from March 23. I start with my mathematical RATIO. I see that the answer contains R, T and O and does not contain A or I.

I happen to remember that OTHER qualifies. It does not hit any new letters, but it places additional restrictions on the ones I already have and eliminates E and H.

Words now lists 37 words that I should choose from. I pick COURT because it contains U, the only remaining vowel.

Words informs me that there are only two possibilities left, TROUT and GROUT. I pick the one without a double consonant and it is the winner.

Pared Down

Here is an atypical, but instructive, example. For this puzzle I am pleased to see Wordler gives RATIO a green A in position 2 and a gold R somewhere in positions 3 through 5. I remember one of my favorite "technical" terms, PARSE.

To use a baseball metaphor, PARSE hits a triple and almost gets an in-the-park home run. Now I need to ask Words for qualifying responses. There are exactly two, PARED and PARER. (Both come from the verb "to pare", which means to cut the outer skin off something.)

One of the choices has a double consonant, so I choose the other one. When it doesn't fly, the only choice left earns the five-leaf clover.

Five Golds

How do I generate five golds? I need the starting guess to be a permutation of the final answer. A few moments thought suggests TAKES and SKATE. I am sure there are other possibilities. But this one is special because STEAK makes it triplets. TEAKS would make four permutations but does not meet the "hard mode" restrictions.

Thanks

Over a year ago, MATLAB programs for solving Wordle puzzles were described by Adam Filion as a guest blogger on Loren's blog and by Matt Tearle with a YouTube video.

Software

Working on my Wordle obsession has been very interesting. I have developed some useful tools and I see forgotten five-letter words everywhere. You can share the fun by downloading the code at this link and running it yourself.




Published with MATLAB® R2023a

|
  • print

コメント

コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。