How an algorithm solves Wordle
May 23, 2023 7:41 AM   Subscribe

How an algorithm solves Wordle Through a modeling method known as Exact Dynamic Programming, the researchers devised an algorithm that solves the game in the optimal manner without fail. In Wordle, players have six tries to guess a five-letter word. After a word is entered, colored tiles reveal whether the letters are in the word and if they are in the correct spot. The model solves the game in just two guesses 4% of the time and in three guesses 57% of the time. It only needs a fifth guess 3% of the time, and it never relies on that sixth and final round.

What word does the computer start with? SALET — an obsolete form of salett, which is an “ornamentally engraved helmet,” according to Wiktionary. For AUDIO-philes out there, Bertsimas and Paskov note that SALET reveals an average of 1.683 colored tiles on the first move, while AUDIO reveals an average of 1.320 colored tiles. The other top words include REAST (an obsolete spelling of rest), TRACE, CRATE, and SLATE.

With SALET, the computer model averages a win in just 3.421 guesses. As a point of comparison, Saint Paul, Minnesota, which boasts the best average Wordle score of any city in the U.S., comes in at 3.51 guesses.

The algorithm achieves this score by opening the game with SALET. Based on the colored tiles that this initial guess reveals, it then determines every possible guess that could follow, pulling from a list of 10,657 five-letter words. (Only 2,315 of these are possible answers, as Wordle limits the universe of solutions.) Finally, based on what’s available, the algorithm picks the most strategically illuminating next word.

Bertsimas and Paskov designed the algorithm to explain each move — in a sense, it teaches best practices by demonstrating its logic. (The website wordleopt.com lets users see what the algorithm suggests based on SALET as a starting word.) As an example, they present a hypothetical case in which somebody begins with the word LIGHT. This guess reveals that IGHT are all the right letters in the right position.

To figure out what comes next, most people would start rolling through the possibilities — TIGHT, FIGHT, MIGHT, RIGHT, and NIGHT, for example. Instead, the computer opts for a second guess of FERMS (Middle English form of “farms”) and, in one line, knocks out five possibilities at once.

For those who play Wordle, it may help to take note of the algorithm’s approach, study a Scrabble dictionary, and brush up on your Middle English. But a simpler first step is to begin a game with SALET, and see where that takes you.
posted by andrewmc (63 comments total) 14 users marked this as a favorite
 
Interesting post. And cool project for the people who made it. And interesting strategic info.. kind of reminds me of the articles about Magnus Carlesen pointing out how he studied the way computers play chess, wildly increasing his success over previous human champions. But also, how depressing! Someone has already said this but we have like the opposite of the technocommunist utopian future we could have had: computers make music and art and play games while we work 80 hour weeks doing tedious and dangerous work.
posted by latkes at 7:47 AM on May 23, 2023 [10 favorites]


NYT’s wordleBot recommends starting with SLATE, but I start with STEAL for similar reasons but I like petty crime more than algorithmic maximization
posted by Jon_Evil at 7:49 AM on May 23, 2023 [8 favorites]


Of course, starting with SALET also means a 0% chance of getting it in one try, since I feel pretty confident that word is not in the answer list.

I've stuck with STARE as my starting word, though my wordling has tapered off in the last few months.
posted by obfuscation at 7:54 AM on May 23, 2023 [4 favorites]


I use LEAST, which is the same letters as SALET (and then if I get no tiles, I use MOUND).

I play on "hard" mode so don't have the option of using a word to eliminate a bunch of letters.
posted by joannemerriam at 7:56 AM on May 23, 2023 [10 favorites]


I always start with a different word and I love it when Wordlebot tells me my starting word is "unusual" and that less than 0.01% of other people started with it.

The model solves the game in just two guesses 4% of the time and in three guesses 57% of the time.


I'm not far off that, tbh.
posted by chavenet at 7:58 AM on May 23, 2023 [7 favorites]


I found that starting with an optimal word was too easy to be fun, so I generally start with the previous day's word.
posted by Nancy Lebovitz at 8:08 AM on May 23, 2023 [10 favorites]


My husband sometimes likes to play with random words that people give him. He's a big fan of the "shuffle" play on Duotrigordle where the game just throws you 3 odd starting words.
posted by obfuscation at 8:11 AM on May 23, 2023 [3 favorites]


i always start with ADIEU but maybe it's more optimal to get consonants than narrow down vowels
posted by kokaku at 8:15 AM on May 23, 2023 [1 favorite]


On first read I have at least two thoughts about this: (A) it ignores the existence of hard mode, which seems kind of a big blind spot, and (2) now that Wordle has an editor the original solution list is no longer canonical. They've solved one subset of possible Wordle outcomes, but it's not as universal as the PR says.

[I was starting with RATIO up until #654, when that was the solution. I tried finding a new starting word that kept my anti-E strategy going, but it felt like I was getting backed into corners more quickly than with RATIO. After a couple weeks I gave up on ever solving it in one again and went back to RATIO.]
posted by fedward at 8:20 AM on May 23, 2023 [5 favorites]


I'm not far off that, tbh.

So of course it takes me 5 turns to solve today!
posted by chavenet at 8:21 AM on May 23, 2023 [3 favorites]


I start with TEARS and sometimes end with them.


(Not really)
posted by Phanx at 8:28 AM on May 23, 2023 [7 favorites]


I also start with LEAST, play by the rules of Hard Mode (though I'm not in Hard Mode), and have an average of 3.69319 guesses per game. Today I got it in 6, because... well, because sometimes the bar eats you.
posted by grumpybear69 at 8:31 AM on May 23, 2023 [1 favorite]


From words using the Scrabble dictionary (SOWPODS or TWL). I believe there is only one word that has six letters and has no other words that can be made with its letters (six letters or shorter).
posted by dances_with_sneetches at 8:45 AM on May 23, 2023


Wordle "puzzle" that I stumbled upon while experimenting with a word search algorithm (I think I remember this right):

You play the word "STALE". You get one green letter only. You now know the answer, what is it?
posted by justkevin at 9:01 AM on May 23, 2023 [1 favorite]


syzygy
posted by dances_with_sneetches at 9:07 AM on May 23, 2023 [4 favorites]


I play on "hard" mode so don't have the option of using a word to eliminate a bunch of letters.

Me, too. SALET is the best starting word for easy mode, but if you use it in hard mode, you risk getting stuck in one of those _IGHT or _UNCH or similar situations where there are more possibilities than guesses and you can only rule out one at a time. What the best starting word is for hard mode is an interesting question. I've been consistently using CHIMP, just because it rules out so many of those second-tier possibilities, and while the first guess often returns no hits, I've also never failed to solve hard-mode Wordle with that starter.
posted by Pater Aletheias at 9:19 AM on May 23, 2023 [1 favorite]


The commonest nine letters in the English language (in descending order) are E, T, A, I, S, O, N, H and R. Accordingly, I always start with HASTE. In the unlikely event that turns up nothing at all, ROBIN is my second line.

A typical score for me is four lines to solve the puzzle.
posted by Paul Slade at 9:37 AM on May 23, 2023


You play the word "STALE". You get one green letter only. You now know the answer, what is it?

Correct me if I'm misunderstanding something here, but I think there's more than one word that satisfies this:

STALE

SCORN
CRAZY
BURLY
DRONE

.. and no doubt some others too.
posted by Paul Slade at 9:51 AM on May 23, 2023 [1 favorite]


I wonder if it's one green and all the rest are yellow, no blacks/grays?
posted by obfuscation at 9:55 AM on May 23, 2023


I do hello wordl, and occasionally dordle. My first 2 guesses were to use trial and mouse as starters, and I've just stuck with those. When I'm tired or feeling lazy, I'll do wench/winch, and then glady, if really stumped. I'll give salet a try, and maybe ratio, haste, and robin.
posted by BlueHorse at 10:00 AM on May 23, 2023


Salet is an alternative form of sallet, not an obsolete form of salett (which is not a word). Both forms are archaic, not obsolete. And salet is also regional Southern US dialect for turnip greens.
posted by 3.2.3 at 10:03 AM on May 23, 2023 [4 favorites]


I start with TRANS every time because it's the NYT.
posted by box at 10:11 AM on May 23, 2023 [23 favorites]


It appears that this algorithm uses the known lists of valid guesses and possible answers as a starting point. Given this and wisely chosen guesses, simple procedural algorithms which find remaining solutions from the possible answer list by just eliminating those that do not contain the exact match (green square), followed by selecting those that contain partial matches (yellow square) but not in that position, followed by eliminating those which contain any unmatched (black square) letters will winnow down the possible solutions very rapidly. Subsequent guesses are selected by determining the letter frequency of the remaining possibles. I’ve done this in Python (and simple shell script) and solve in 4 or less steps >95% of the time. I’m not sure the woo of ‘Exact Dynamic Programming’ stands up.

Further, if you’re willing to use the list of unused Wordle answers (readily available online), you can solve in 3 steps >75% of the time. I usually use ‘heart’ and ‘sonic’ to start when I play unaided. If I cheat, the letter frequency in the unused answer list is ‘earol tsinc uydhp’ so I use ‘cleat’, ‘rosin ‘, and ‘dumpy’ if I draw blanks.

Caveat: The editor changed to ‘curated’ answers early in 2023 and recently had one that did not appear in the canonical list, so using any list is not always going to lead to the correct answer.
posted by sudogeek at 10:17 AM on May 23, 2023 [1 favorite]


Correct me if I'm misunderstanding something here, but I think there's more than one word that satisfies this:

STALE

SCORN
CRAZY
BURLY
DRONE

.. and no doubt some others too.


Hint:

You know the answer after playing STALE.

If the "S" is green, you don't know the answer is SCORN, it could also be "SCOOP" or "SHIRK" or many others.

posted by justkevin at 10:25 AM on May 23, 2023


I start with STARE and then proceed to.
posted by swift at 10:39 AM on May 23, 2023 [1 favorite]


ITCHY?
posted by Paul Slade at 10:40 AM on May 23, 2023 [3 favorites]


Every day, the New York times has a columnist write about solving the word that day. I am struck by how often they get it in three. I often wonder how the columnist solve rate compares to the average, and how often the columnists cheat. I would think it happens pretty often given how often the columnists talk about how scary it is to solve wordle publicly.
posted by surlyben at 10:41 AM on May 23, 2023 [2 favorites]


I've stuck with STARE as my starting word, though my wordling has tapered off in the last few months.

Yeah, sticking with STARE myself, could try STALE, I suppose, though it's unclear to me whether L or R would be more common in wordle-approved-words.
posted by Navelgazer at 10:48 AM on May 23, 2023


I start with TRIES then DOULA… but that easily becomes DOUCE or DOUBT as needed.
posted by janell at 10:55 AM on May 23, 2023


They really should have explained what Exact Dynamic Programming (DP) was, because it is so interesting. DP a very general algorithmic technique that is powerful because it solves a given problem by kind of "working backwards" and furthermore saving all the intermediate answers in an organized way to help speed up the process. So, it's a very intuitive idea for humans really except the computer will do it making no mistakes. But what's interesting is that the example in the article says people would guess ?LIGHT while the program would guess FERMS and kill 4 birds with 1 stone--that's not programmed into DP, that's an emergent strategy as a result of the exact DP algorithm. As I understand it.
posted by polymodus at 10:57 AM on May 23, 2023 [1 favorite]


I always start with everyone's all-time favorite word, MOIST.
posted by ewok_academy at 11:06 AM on May 23, 2023 [1 favorite]


For STALE to have only one green I could see LEAST but I don't know if that's a unique solution.
posted by jclarkin at 11:07 AM on May 23, 2023 [1 favorite]


I have two starting words.

My first guess is always ROUTE, and then depending on how that goes for me, I will often follow it up with PLAID. Obviously, I do not play on Hard Mode. I feel like this usually nets me my vowels and sets me up to proceed.
posted by kbanas at 11:56 AM on May 23, 2023


For me it's STARE and if I have no matches, BLINK. If my husband's nearby I'll ask him for a starting word and he'll suggest PENIS which make us both laugh but isn't a terrible word to start with either.
posted by kimberussell at 12:18 PM on May 23, 2023 [2 favorites]


I pick a random word each day, based on something I just heard. Art, not science.
posted by kerf at 12:35 PM on May 23, 2023 [3 favorites]


I usually start with RAISE so I knock off 3 vowels right away.
posted by mike3k at 1:07 PM on May 23, 2023


My pre-hard mode strat was to do SNARE, PILOT, DUCHY loosely based off scrabble tile frequencies. Then I started using PILOT as my first guess, since my husband is a pilot (he uses ALOFT for his #1), then I realized PILOT had been an answer already, and went back to SNARE. It's frustrating though, since the letters are a little *too* common.
posted by rubah at 1:17 PM on May 23, 2023


Yep, ITCHY is it!
posted by justkevin at 1:21 PM on May 23, 2023


I play on hard mode as well. My wordle algorithm:

1) Pick a 5 letter word that sums up my day
2) Pick a 5 letter word that fits my mood
3) Guess the secret word

I usually get it in 3, maybe 4 tries if I'm unlucky. I like the randomness rather than using the same starting word. Keeps me playing.
posted by lock robster at 1:42 PM on May 23, 2023 [2 favorites]


I use a different word every day(hard mode). Today, I was inspired by this thread and used STARE. I’ll be damned if I didn’t get it in two!

Yay, Metafilter!
posted by Big Al 8000 at 1:55 PM on May 23, 2023 [2 favorites]


I've been working on a Wordle solver for a few months, and I think my program's average best word, LEAST (same as WordleBot's for hard mode) is at 3.444. I'm not a real programmer, and I haven't figured out how to program it for regular mode, so I do it in hard.

A friend sent me this paper a few weeks ago, and it has a major problem: it relies on the original 2315 and 10657-word lists from before the NYT bought Wordle. (Note the paper says 10657 'possible valid guesses, but that doesn't include the 2315. So the original total valid guesses was 12972)
The NYT removed some of the words from what I call the 'Target' list- the ones that supposedly are the only answers, and later added some to the valid list. That may not change the 'best answer', but I would think the percentages would change a lot with the shortening of the target word list- today was the 704th puzzle, so there are now just over 1600 'possible answers'.

The reason that's in quotes is that recently the NYT Wordle editor slipped in two words that were not in the possible answer list. I guarantee this program didn't solve March 27th's or April 9th's puzzles in 5 or less, because the answers were not in the 2315-word list.

I had thought I had all the bugs out of my program before that happened, but it required a major re-write to accommodate the full 14855 valid words in a timely manner. (And that's assuming new words aren't added in the future)
posted by MtDewd at 1:59 PM on May 23, 2023


First pass, I was skimming the replies here and not paying too much attention, and when I went back over them and I got to justkevin's puzzle, so I ran it by my program (one green letter at a time), and came up with the answer.
So that's why I saw the word ITCHY while skimming....
(OTOH, that word has already been used (last Nov 25), so unless the puzzle editor puts it back in, which seems to be possible. In that case OTIUM could be another answer)
posted by MtDewd at 2:20 PM on May 23, 2023 [1 favorite]


But also, how depressing!

I mean, unlike art, it’s pretty easy to frame this kind of game in mathematical terms and thus to write an algorithm to solve it. Sometimes the game exercises something of human capabilities that makes it enjoyable anyway, sometimes it doesn’t. Unlike large scale machine learning, the algorithmic solution itself is still human ingenuity. That was always my line about Sudoku - that I’d have more fun just writing a program to solve them, rather than executing the same basic algorithm myself - in contrast to crosswords which have more lateral thinking.
posted by atoxyl at 2:26 PM on May 23, 2023 [1 favorite]


I also use "stare". Yeah, sometimes you do get caught (StARe/SpARk/SwARm/SnARl/ShARd/SCARs Ans.=SCARF). And the words do repeat. "Cedar" was the first I noticed.
posted by CCBC at 2:35 PM on May 23, 2023


I have a starting combo of SCRAP, followed by TOILE if I get no green or yellow squares in the first guess. I tried using LEAST for a while, but I found it hard to come up with valid guesses a lot more often (which was frustrating) and also had a couple puzzles with more possible answers than remaining guesses as discussed above. The linked bot is clever, but not as interesting since it doesn’t play in hard mode.
posted by stopgap at 3:16 PM on May 23, 2023


I used to just start with whatever word popped into my head, but I like a high number of consonants, so I've been using CREST lately. (Followed by DAILY if all gray)
posted by MtDewd at 3:54 PM on May 23, 2023


For me it's STARE and if I have no matches, BLINK.

Oh, BLINK is a solid no-hits second word for sure. Mine (following STARE) is MOUND.
posted by Navelgazer at 3:54 PM on May 23, 2023 [2 favorites]


I've given up on Wordle. I just do Spelling Bee with BeeBuddy and fake my way to Genius instead.
posted by lhauser at 7:25 PM on May 23, 2023


My first three words for wordle have been ORATE LINDS CHUMP since almost the beginning. It's not foolproof, as I missed PARER and VOTER. Other "...ER" words are also elusive sometimes.

For lirdle.com, where there's one incorrect response on each line, I've been starting with the near-sentence FJORD NYMPH BOXES QUICK WALTZ . Five potential target words that cover all the letters but G and V. The disadvantage is sometimes the lying leaves me with no idea. Last weekend I knew I was going to be spending about 3 hours driving in heavy traffic, so I took a few 90s-era CDs for the drive, including a Phish album from 1994. I found it had held up well some 30 years later, but it didn't help me the next day, when I needed 28 tries to figure out HOIST.

[Disclaimer: I wrote lirdle, and it's still going strong, thanks largely to this site.]
posted by morspin at 8:13 PM on May 23, 2023 [3 favorites]


If you think of the word you start with as an origin and the solution as the destination, then the computer’s approach reminds me a bit of the Waze app giving driving directions vs a person, or a computer deciding a sequence of moves in a chess game. There is a quality to the moves it makes that are just not human. For example starting with some obscure word that is an anagram of a more common word. In chess and in GPS the computer has no fear, because it knows.
Cut over 3 blocks now, or just stay on the primary road. A human wouldn’t take that gamble if it might save a minute, but Waze will because it knows from its traffic data the human can’t be sure about that it will. In chess computer you might have two moves that win, the first one is a simple winning plan that gives a likely decisive advantage like wining the queen. The second is more complicated and also looks winning. The human plays the simpler move. However the computer sees that the more complicated move that forces a set of trades where there are fewer than 7 pieces left on the board. Since chess is solved for the computer when there are fewer than 7 pieces, and the computer sees that the position is a win, it plays the complicated move.
posted by interogative mood at 9:53 PM on May 23, 2023


I'm a bit bemused by the interest level in optimizing Wordle, especially by comparing to computer algorithms.

The computer approach to Wordle is to basically know all the possible words and then eliminate the maximum number. Fair enough. It's logically a great approach and a computer is good at it.

The fun for a human--well, for me, anyway--is the pattern matching of a relatively easy, low stakes game. "There's an N in position 2, an E somewhere but not position 5, and the common letters I haven't used include a R, P, A, H, C, or L . . . what can I spell?" If I actually could summon up all eight or however many remaining words, the best thing to guess next would be trivial but a bit tedious to sort out. No joy whatsoever. I am fortunate I can't use computer's approach.

It can feel like a magic trick to guess three times, and not get better than two yellows, then finish on guess four with all greens. In reality, Wordlebot will tell you that you had, not a vast sea of words, only two valid options to pick from, but that's just such a boring way to think about the last move.
posted by mark k at 9:58 PM on May 23, 2023 [7 favorites]


I agree so much, mark k.
I start every morning with Wordle, and what is important to me is how fun it is to solve the game. Today was a good game for me, even though I only got it in four, and while it is thrilling to get a game in two, it can also be a bit disappointing that the game is already over. I start with a word that describes the sky outside: CLOUD, CLEAR, MOIST, STARS. Or a random word. Since I play for the feeling of it, it would be boring to optimize my first word in any way.

I can't really explain which games are fun and which aren't, though I'm going to remember that thing in the article where the bot uses all the possible consonants for one of those puzzles where you need to find just one letter. Because they are really irritating.

Does anyone play Quordle? There, I start with a (nearly) fixed set of three words, otherwise I'll lose every time. Strangely, it is not an advantage if one of your words is green.
posted by mumimor at 11:21 PM on May 23, 2023 [2 favorites]


I start with STORE, which I know is suboptimal, but I’m stubborn. My average is 3.71, which is nothing to brag about, but I’m a filthy casual.
posted by darkstar at 1:58 AM on May 24, 2023


It can feel like a magic trick to guess three times, and not get better than two yellows, then finish on guess four with all greens.
That has happened to me many times. Sometimes it feels like luck, and sometimes skill.
I agree it can be disappointing to win it without many clues. Like I want to work a little. Never got it in 1, but I think that would be mixed feelings.

Today was
⬜🟨🟨⬜🟨
🟨🟨⬜🟩🟩
⬜🟨🟩🟩🟩
🟩🟩🟩🟩🟩
which is the kind of game I enjoy.

One thing I think I learned from trying to program a solver is to think of all the words I can that fit and see what's in common- to pick a word that would give more clues if it wasn't the answer.
I don't expect to get the computer's best guess because there's always words I don't think of.
Another benefit is that I have seen the lists of words. There's no way I could memorize them, but I'm sure I got KAYAK and JOKER sooner than I otherwise would have.

Aaaaand, this morning I found another bug in my program. Most of this is so easy, but those damn repeated letters and yellow....
posted by MtDewd at 4:17 AM on May 24, 2023 [1 favorite]


Despite its name, Hard Mode is easier in one way. In Standard Mode, I'll occasionally make a bone-headed mistake by missing out a letter the puzzle's already told me has to be included. Hard Mode prevents me from wasting a line like that.
posted by Paul Slade at 5:28 AM on May 24, 2023 [4 favorites]


Aisle is my starting word; get those vowels figured out! Unless I feel like using another RSTNL word. Some days it works, some days it doesn’t.
posted by TedW at 12:56 PM on May 25, 2023


Reading this thread (finally!) has me reconsidering my approach. Too often I wind up in this situation:

⬛🟨🟩⬛🟩
🟩⬛🟩⬛🟩
🟩⬛🟩⬛🟩
🟩⬛🟩⬛🟩
🟩⬛🟩⬛🟩
🟩🟩🟩🟩🟩
posted by kingless at 7:59 AM on May 26, 2023 [2 favorites]


I proved once that the worst starting word is XVIII (in that it reveals the least possible information overall).
posted by willF at 12:06 PM on May 27, 2023 [2 favorites]


XVIII is one of my favorite legal Wordle 'words'. How is that even in there? The only other possible roman numeral might be MIMIC- 1999??

I'm testing XVIII now, but it will take a while to compare it to QAJAQ. I think that will at least give it a run for its money.

My favorite ironic legal Wordle word is SRSLY. Self-evaluated.
posted by MtDewd at 4:19 PM on May 27, 2023


I proved once that the worst starting word is XVIII (in that it reveals the least possible information overall).

How is that legal? Thank you, though, I was planning to look for a starting word the Wordlebot didn't say was "pretty good." I had tried "ARRGH" which seems horrible to me but it still liked it.

The only other possible roman numeral might be MIMIC- 1999??

AFAIK, MIMIC is not a valid Roman numeral. (1999 would arguably be MIM, but even that is apparently not something Romans would use, as you can't "subtract" an I from anything except an X or a C.)

But SRSLY? Going to try that out too!
posted by mark k at 6:48 PM on May 28, 2023


as you can't "subtract" an I from anything except an X or a C.

Sorry, that should be "can't subtract an I from anything except an X or a V.
posted by mark k at 7:03 PM on May 28, 2023


Yes, I posted MIMIC too quickly and went to bed. Should have said 'closest'.

How is that legal?
It's legal because it's in the word list. Not sure how the list was derived, but it's currently THE dictionary for Wordle. Some interesting 'words' in there.
I had tried "ARRGH" which seems horrible to me but it still liked it.
I've been testing a number of words every day against the daily answer. One of those is CRWTH (the only word I found with no vowels or repeating letters), and it's been averaging around 3.6 guesses in Hard mode.

I let the computer run over the weekend on XVIII and QAJAQ, against the 2309-word list, in Hard mode.
(I assume that was the list willF used, as XVIII was not on the original, pre NYT, Wordle list)
I let it run past 6 guesses and included 7's and 8's in my average.
XVIII came in at 4.268 guesses, including 29 over 6. QAJAQ came in at 4.365 guesses, with 35 over 6.
For comparison, I got 3.599 for SALAT. So there doesn't seem to be a big difference between the best words and the worst words, over the long haul.
(YMMV)
posted by MtDewd at 3:03 AM on May 29, 2023


dances_with_sneetches: syzygy

At your service!
posted by syzygy at 3:06 PM on May 31, 2023


« Older Rise and shine. The world is doomed.   |   Rick and Daniel chatting for a while Newer »


This thread has been archived and is closed to new comments