# Wordle

Before we start, this post is going to contain what some people might consider to be spoilers for the game of Wordle. I’ll be using an actual solution as an example.

Are you annoyed by all your friends posting their Wordle answers online? Do you think of a word and then go blank when presented with a few blogs of colour? Well, I have the answer for you: the Wordle cheat program. No more do you have to appear ignorant of English to your friends. Use this simple program to help you guess words for Wordle.

## How does it work?

As you may already know, the list of words used by Wordle is widely available on line. In fact, there are two lists: the list of solutions with approximately 2,000 words in it and the list of allowed words with approximately 10,000 words in it. The Wordle cheat program knows all of those words (mixed together in alphabetical order) and, based on some simple rules that you provide it, it will give you the words that match the rules. Here is how it works. As my first guess, I enter the word “notes”.

Now we know it has o, t and e in it but not n and s. This is encoded as a rule in Wordle: `ote^ns`. Read the `^` as “not”. If we run the program with that rule, we get something like this:

``````jeremyp@anyanka wordle % swift run wordle --cheat 'ote^ns'
Building for debugging...
Build complete! (0.08s)
towze
botte
objet
emote
<< snip >>
coate
oater
orate
roate
Count of words left: 121
``````

The `--cheat` option just orders the words with more likely ones near the bottom based on letter frequencies. We still have 121 words which is a lot, but we also haven’t used all the information. For example, we know that the second letter is not an o. As well as the general rule `ote^ns` we can add position specific rules e.g. `2:^o`. Again, read `^` as “not”. This says “letter 2 is not o”.

``````jeremyp@anyanka wordle % swift run wordle --cheat 'ote^ns 2:^o'
Building for debugging...
Build complete! (0.08s)
objet
emote
epopt
petto
octet
<< snip >>
atoke
oater
orate
Count of words left: 57``````

That’s taken the possibilities down to 57 and you can see that towze and botte are no longer in the list. Let’s add the other two position specific rules.

``````jeremyp@anyanka wordle % swift run wordle --cheat 'ote^ns 2:^o 3:^t 4:^e'
Building for debugging...
Build complete! (0.08s)
emote
epopt
quote
theow
<< snip >>
aweto
teloi
atoke
orate
Count of words left: 32
``````

Now let’s do our second guess. “Orate” seems like a likely choice.

There’s no a, but there is an r and we know where it and the e are.

``````jeremyp@anyanka wordle % swift run wordle --cheat 'rote^nsa 1:^o 2:r 3:^t 4:^et 5:e'
Building for debugging...
Build complete! (0.08s)
trove
troke
trope
trode
Count of words left: 4
``````

The global rule now says that r, o, t and e are in the word, but n, s and a are not. We know the first letter is not an o, the second letter is an r (we also know it is not an o from the first guess, but in `2:r^o` the “not” part is redundant because it is implicitly encoded in the “it definitely is an r” part), the third letter is not a t, the fourth letter is neither a t nor an e and the fifth letter is an e.

We have four possible answers left. The real answers were selected by a human being picking out “well known” words from the list, so we’ll ignore “troke” – no idea what it means: the Apple dictionary says it’s just a surname. We’ll take trove as being the most familiar word.

Now we have four out of five letters.

``````jeremyp@anyanka wordle % swift run wordle --cheat 'rote^nsav 1:t 2:r 3:o 4:^et 5:e'
Building for debugging...
Build complete! (0.08s)
troke
trope
trode
Count of words left: 3
``````

That just eliminated trove. I think we are still safe ignoring troke, so we’ll go with the word that I think is most familiar which is trope.

Ta da!

Having written the program to prove I could do it, I have to admit I don’t use it for Wordle because it sucks all the fun out of the game. However, for Quordle, it reduces the difficulty to relatively easy but not so trivial it’s no fun.

This site uses Akismet to reduce spam. Learn how your comment data is processed.