Wednesday, June 8, 2022

Wordle Solver

 So, this popular word game called Wordle. I played it a few times, and of course, I immediately want to use the computer to do it. My usual computer is Raspberry Pi, and it turns out that it's so easy, I don't really need anything more than a bash CLI. 

My first guess was YODEL. The clue was YE aren't used, and ODL are misplaced. So, I use this command:


cat wordlistb.txt | grep -v [ye] | grep ^.[^o][^d].[^l]$ | grep o | grep d | grep l


Amazingly enough, it gives me 6 answers immediately.  Wordlistb.txt is the culled wordlist, by the way. The complete wordlist gives me 11 answers. That's quite a trim from the whole word list.

The command basically says 

1. Write out wordlistb.txt

2. Trim lines with letter y,e.

3. Include only lines with any-not o-not d-any-not l pattern

4. Include only lines with letter o

5. Include only lines with letter d

6. Include only lines with letter l

Looking at those 6 words, I search the word list from various possible letters. So, this is what I use:


grep [abcfs] wordlistb.txt


Among the word list, there is this word SCARF, that uses 4 of the missing letters. Hence, I put it in, and it reveals that none of the letters are used, except the letter F, which is misplaced.


cat wordlistb.txt | grep -v [ye] | grep ^.[^o][^d].[^lf]$ | grep o | grep d | grep l | grep f


And it gives me the answer immediately. Solvable in 3 tries!


No comments:

Post a Comment