Not sure if I will keep going with this mini-obsession, but I’ve been writing about solving wordle puzzles using the command line. My grep
pipeline is awkward and it would be nice to have an easier notation. The obvious idea is to use capital letters to designate correct letters in the correct location:
LEMUR
For letters that are in the wrong location, use lowercase:
...e.
Dots are simply placeholders for positions we didn’t learn anything new about.
But what about all the letters that have been eliminated? Position doesn’t matter, so we can tack those in square brackets after correct and partially correct letters:
..... [stain]
So here’s the first puzzle I wrote about:
..... [stain]
...e. [hopd]
.re.. [wck]
.Er.. [fy]
LEMUR
The solver would keep track of eliminated letters, wrong positions and correct letters. So internally it would be:
..... [stain]
...[^e]. [stainhopd]
.[^r][^e][^e]. [stainhopdwck]
.E[^er][^e]. [stainhopdwckfy]
LEMUR [stainhopdwckfy]
Obviously the final word would not need to be entered.
One trick is when someone accidently enters an eliminated letter such. When I guessed “ferry”, I mistakenly entered R as an eliminated letter, which gave me a completely different (and wrong) list. The solver ought to warn the user of this sort of contradiction.
Ideally it would also track other contradictions such as two letters marked as the correct letter in the same location.
A simple version would just show words that match the restrictions. A more advanced version would sort by best next guess (algorithm to be determined). Even better would be giving guesses that don’t use the correctly positioned letters if you still need to explore the letter space.