14
$\begingroup$

Wordle is a viral web game where you have up to six attempts to guess a secret five-letter English word* using the letters A-Z.

After each $5$-letter guess (which must itself be a real English word*), an emoji describes the secret word for each letter guessed:

  • ⬜ (White) means the guessed letter is not in the secret word.
  • 🟨 (Yellow) means the guessed letter is in the secret word, but in a different position.
  • 🟩 (Green) means the guessed letter is in the secret word, in that position.

For example, if the secret word is ENTER, here is a possible playthrough:

  • PIZZA
  • TROUT
  • TROUT (pointless, but legal)
  • SHEEP
  • ENTER

would result in the following, tweetable, output (with letters to help folks whose browsers don't parse the emoji as intended):

⬜⬜⬜⬜⬜ (WWWWW)
🟨🟨⬜⬜⬜ (YYWWW)
🟨🟨⬜⬜⬜ (YYWWW)
⬜⬜🟨🟩⬜ (WWYGW)
🟩🟩🟩🟩🟩 (GGGGG)

Note that the last row may not be 🟩🟩🟩🟩🟩 (GGGGG) if the correct answer is not found in six tries. Also note that the repeated T in TROUT only was colored once as it only appears once in the secret word.

I know that the total possible combinations of ⬜🟨🟩 (WYG) used in a string of five emoji would be equal to $3^5=243$. But this is ignoring the English word restriction (is every combination of emoji even possible?).

* A specific answer may depend on the dictionary used. The actual game of Wordle uses a restricted dictionary of words that can be guessed (including obscure "Scrabble words"), and a further restricted dictionary of words that might be used as a solution (words more likely to be recognized as such by most players).

$\endgroup$
9
  • 6
    $\begingroup$ Are you playing "normal" - any legal attempt is allowed - or "hard" - attempts must be consistent with the previous responses? Are you restricted to the two Wordle lists (legal words to try and the shorter list of words that may be the solution)? $\endgroup$
    – Henry
    Feb 7, 2022 at 20:40
  • 2
    $\begingroup$ I think the answer might be more interesting assuming hard mode, although I actually don't remember offhand what restrictions it exactly makes. (I think it just requires green letters to be used again, but maybe it allows the wrong position?) I added info on dictionaries to my question. $\endgroup$ Feb 7, 2022 at 20:56
  • $\begingroup$ Could you please use symbols other than emoji? My browser is rendering them as indistinguishable "unknown glyph" boxes. $\endgroup$
    – Blue
    Feb 7, 2022 at 21:10
  • 1
    $\begingroup$ @fleablood There's a "hard" mode in which any positive information has to be reused. So if you know that there's an e in the first letter and an s somewhere in the word then every subsequent guess has to start with an e and contain at least one s. Also, not all patterns are possible: you can't get YGGGG, for example. And there are words that disallow even more patterns. $\endgroup$ Feb 7, 2022 at 23:17
  • 1
    $\begingroup$ See also this post on Puzzling SE. $\endgroup$ Feb 10, 2022 at 10:41

2 Answers 2

3
$\begingroup$

A precise answer will likely require computational assistance, with knowledge of the specific dictionaries used in Wordle for valid guesses and valid final answers. This answer will aim to answer the question for a very permissive dictionary, where any combination of 26 letters A-Z may be used as a guess or secret word.

First, an upper bound. A full game with $n$ guesses results in $5n$ emoji shown. There are $3^{5n}$ combinations of three characters in a string of length $5n$, so $\sum_{n=1}^6 3^{5n}$, or 206,741,921,896,692, is a very rough upper bound.

We could be more careful. A game ends with GGGGG, or after six incorrect guesses. Likewise, any of the five permutations of GGGGY is impossible, since the single yellow cannot be both in the word but in the incorrect position (an extra letter that appears elsewhere is marked as Black, not Yellow). So a more careful upper bound would be $\sum_{n=0}^6(3^{5}-6)^n$, or 177,961,648,104,787, where $n$ counts the number of incorrect guesses in a game (any correct guess GGGGG is fixed), and $3^{5}-6$ counts the number of possible ways to make each incorrect guess.

Finally, we can show this upper bound may be realized (with our permissive dictionary). Given a secret word $l_0l_1l_2l_3l_4$ we should show that any emoji output besides a permutation of GGGGY is possible; we may assume the $l_n$ are distinct. Permutations of Gs/Bs are easy: use correct letters for G and distinct $x\not=l_n$ for each B otherwise.

Given emoji output with multiple Y (and any number of G,B), we may use correct letters for each G, distinct incorrect letters for each B, and rotate the correct letters among the Y. For example, GBYBY could be realized using $l_1xl_5yl_3$, where $x,y,l_n$ are all distinct.

Finally we only have the case where we have at least one B and exactly one Y. In this case, fix one B and the Y. Let $l_i$ be the correct letter for the B position; we may guess a word with $l_i$ in the Y position, and a letter $x$ distinct from every $l_n$ in the B position. We then complete the word using correct letters for each G and new incorrect (and distinct) letters for every other B position.

Thus for a permissive enough dictionary, there are 177,961,648,104,787 possible Wordle tweets. (We leave open the cases where players must use information gained from previous guesses to make future guesses.)

$\endgroup$
2
$\begingroup$

This is an answer strategy for easy mode.

Given a particular hidden word, there are only certain patterns that are possible with that word. (Indeed, with the Wordle dictionaries then every word is uniquely distinguishable by its possible patterns.) Every one of those patterns could be a line in a possible shareable output with the exception of the "all green" pattern which can only be the last one.

There are two types of shareable outputs: solved and unsolved. A solved puzzle ends with the "all green" line, so the variation is fully in the other lines and so can be viewed as being of one line fewer. An unsolved puzzle is of length $6$ with all lines being any pattern (other than the "all green"). So for each integer $k$ from $0$ to $6$ we have shareable outputs with $k$ freely chosen lines.

Suppose that a word has $N$ possible patterns, not including the "all green" one. Then each freely chosen line has $N$ possibilities, so we get:

$N^0 + N^1 + N^2 + N^3 + N^4 + N^5 + N^6 = \frac{N^7 - 1}{N - 1}$

possible outputs.

So then it is a question as to how $N$ depends on the words. For the first ten words in Wordle's puzzles, I get:

word  |  N  | number of patterns
--------------------------------
cigar | 144 |  8978450801041
rebut | 152 | 12414469570777
sissy | 100 |  1010101010101
humph |  88 |   469742064793
awake | 117 |  2587277686267
blush | 135 |  6098620104361
focal | 140 |  7583705323741
evade | 124 |  3664769671501
naval | 135 |  6098620104361
serve | 146 |  9752186278927

To work out how many there are overall, we can use the inclusion-exclusion principle:

$$ \left|\bigcup P_i \right| = \sum \left|P_i\right| - \sum \left|P_{i j}\right| + \sum \left|P_{i j k}\right| - \dots $$

where for a multi-index $\alpha$ then $P_\alpha$ is the patterns that are visible on all the days represented by $\alpha$.

Now for a pattern to be visible on all of a set of days, it must be made up from the individual patterns that are possible on all of those days. So if $N_\alpha$ is the number of individual patterns possible on those days then $\left|P_\alpha\right| = \frac{N_\alpha^7 - 1}{N_\alpha - 1}$.

Figuring out $N_\alpha$ is straightforward from lists of the patterns visible on each day as we simply take the intersection of those lists for the days in $\alpha$ and then count the patterns in that intersection.

Nonetheless, that's still a lot of calculations to do since there are $2315$ words and so there are $2^{2315} - 1$ intersections to consider. I don't have a sense of how long that would take to compute ... which is why I'm calling this a strategy rather than an answer. (Actually, it's not quite $2^{2315} - 1$ because it turns out that some words don't add new information: the possible patterns for a word are a subset of the possible patterns for another, so we don't need to consider the first word as any combination valid for that word will also be valid for the second. This reduces the number of words from $2315$ to $2195$. A slight improvement.)

As $2^{2315} - 1$ is a rather large number, it may be better to work from the other direction: generate all possible patterns of length at least $6$ and then see if there is a word which matches each set. There are $\frac{242^7 - 1}{242-1} = 201692857670767$ such patterns. Although this is a large number itself, it is far smaller than $2^{2315} - 1$. My code for this has produced the current results, in which the length does not include the "all green" pattern and (for optimisation purposes) it is computing the number of unordered patterns with no repetitions of each length:

  1. There is $1$ set of patterns of size $0$
  2. There are $237$ sets of patterns of size $1$
  3. There are $27904$ sets of patterns of size $2$
  4. There are $2167163$ sets of patterns of size $3$
  5. There are $124422040$ sets of patterns of size $4$

So with a bit of combinatorics, I get:

  1. There is $1$ pattern of length $0$ (ie, win first guess)
  2. There are $237$ patterns of length $1$.
  3. There are $56045$ patterns of length $2$.
  4. There are $13170639$ patterns of length $3$.
  5. There are $3064537721$ patterns of length $4$.

Updates as the code finds more


Obviously, I'm not going to do any of these calculations by hand. The core code can be found on github. The two programs needed to work out an answer to the above are:

  • patterns.py: This works out which patterns are possible for each word (actually, it works out which are not possible) and saves it to a file wordle_zeros.
  • PossiblePatterns.py: This takes the file wordle_zeros and uses it to work out the total number of patterns using the inclusion-exclusion strategy outlined above.
  • MorePossiblePatterns.py: This also uses wordle_zeros and use it to work out the total number of patterns by testing each pattern of length at most $6$.
$\endgroup$
4
  • $\begingroup$ Erm... Your answer seems to be much bigger than $3^{30}$ (which is an upper bound allowing for arbitrary WYG in any of the 30 squares). Am I missing something? $\endgroup$ Feb 7, 2022 at 22:21
  • $\begingroup$ Also your Github link should presumably be github.com/loopspace/Word-Games $\endgroup$ Feb 7, 2022 at 22:23
  • $\begingroup$ @preferred_anon Thanks for the catch on the github link. The estimate of $3^{30}$ would be per word. The "in total" means "for all words" so you should multiply that by $2315$ (the number of possible words) to get $476637970799112435$, which is bigger than the number I wrote by a factor of about $20$. Also, $3^{30}$ isn't quite right as that assumes all lines are filled and the output can be of any number of lines. $\endgroup$ Feb 7, 2022 at 22:34
  • $\begingroup$ Ah, but I see I've made a miscalculation in that simply adding up over each word produces repetitions. I'll make that clear. $\endgroup$ Feb 7, 2022 at 22:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .