Wordle Feb 17, 2024

I felt pretty happy getting this wordle in 4 guesses, as you can see. But how good was my 4th guess?

3 guesses into Feb 17, 2024 Wordle puzzle

My starter word is CRANE, based on the 3blue1brown video about solving Wordle with information theory. I really should prepare some second guesses for situations like “getting the A”, and “not getting any letters at all”.

I feel pretty smug about getting PSALM without any computer assistance, but I wasn’t confident that was the only possible solution, so I double checked using regular expressions.

#!/bin/bash
set -eou pipefail

grep '^.....$' /usr/share/dict/words |
tr '[A-Z]' '[a-z]' |
grep -E '^[^crneigots][^crneigotm]a[^crneigotm][^crneigotp]$' |
    grep s | grep m | grep p

The script above does yield “psalm” as the only possibility, so my guess was quite good.

The yellow M, S and P in guesses 2 and 3 mean that the regular expression can have different (negated) ranges of characters in columns 1, 2, 4 and 5, but also cause problems with how to ensure the regular expression has an M, a P and an S in it.

The last few Wordles that I’ve written up have interested me because I could write a single, moderately elaborate regular expression that handled constraints from yellow letters.

In the shell script above, I filtered out matches from the bigger regular expression that didn’t have an M, a P and an S in it. If you accept that the yellow M, P and S mean there’s only one of each in the solution, you could constrain the guess a bit further:

  1. column 1 can have M or P
  2. one of columns 2 and 4 are not M
  3. column 5 is not P
  4. column 3 has an A

These constraints fall out like this:

  1. column 1 has an M
  • column 2 could have an S (although I don’t think English has any words with “MS” prefix)
    • column 4 has a P, column 5 is not any of the black letters
  • column 4 could have an S
    • since column 5 can’t be P, column 2 is P, and column 5 is not any of the black letters
  • column 5 could have an S
    • column 2 is P, column 4 is not any of the black letters or M
    • column 4 is P, column 2 is not any of the black letters or M
  1. column 1 has an P
  • column 2 could have an S, that makes column 4 not any black letter, column 5 is M
  • column 4 could have an S, that makes column 2 not any black letter, column 5 is M

This makes a fantastically complicated regular expression:

#!/bin/bash
set -eou pipefail

grep '^.....$' /usr/share/dict/words |
tr '[A-Z]' '[a-z]' |
grep -E '^m((sap|pas)[^crneigot]|pa[^crneigotm]|([^crneigotm]ap)s)|p(sa[^crneigot]|[^crneigot]sa)m$'

I did combine the three regular expressions that begin with M, and the two beginning with P and ending with M just to make the resulting regular expression even more complicated. Contrary to the old saw about regular expressions, the regular expression was the point of this, not the second problem. It also finds only PSALM as a possible solution for Wordle 973.

This regular expression is a little more confirmation that yellow letters can be used to constrain possible answers via alternation of regular expressions.