Back when Wordle was 🔥 🥵 one of my friends sent me this message or more of an attachment I suppose titled "Cool kids playing wordle be like"
My initial reaction to this was it's probably a reddit post from r/wordleNerds or something there's no way they actually did that
Turns out that the screenshot wasn't from r/wordleNerds and that they just used Incognito to keep retrying until they found all the words
On the advent of this discovery I used DEF - Thats easy ngl
ATK - I dare you to do another unique pattern
FUCK How do I keep getting compelled into these pointless challenges, an intellectually superior being like myself shouldn't be spending precious time on making patterns in some box letter game
Making patterns in a box letter game
I could just try and get another pattern by hand but what am I some simple minded peasant?
I could simply make my computer do all the heavy lifting for me instead of spending hours sifting through the Oxford Dictionary
I remembered having read somewhere on some article that all Wordle words are hardcoded into the website's source and after a few minutes of indulging myself in obfuscated React generated JavaScript I found the words in an huge array
There are actually two separate hardcoded arrays for all possible Wordle words
- Valid english words (Sequentially used as the word of the day)
- Non-valid words (Wordle accepts them but they won't be the answer)
Alright now all I have to do is know the correct word and I could make any concoction of aligned multi-coloured letter boxes
The hard part
Alright now I have a SOLID plan time to implement it in written code
I chose to write the program in JavaScript and run it using Node.js (Deno didn't exist ig) because a compiled language felt overkill for something this simple
Inputs
- A
5 x 6
grid of the colours I want - The correct word of the day
Comparing each row of the desired output to the correct word of the day it is possible to generate a RegExp test for each character
Assuming the correct word is SNAIL
and the pattern of the
first row is Gray
- Gray
-
Yellow
- Yellow
- Green
Expected | Correct | Predicate | RegExp |
---|---|---|---|
Gray |
S |
Any except SNAIL |
[^SNAIL] |
Gray |
N |
Any except SNAIL |
[^SNAIL] |
Yellow |
A |
Any of SNIL |
[SNIL] |
Yellow |
I |
Any of SNAL |
[SNAL] |
Green |
L |
Only L |
L |
Joining all RegExp tests [^SNAIL][^SNAIL][SNIL][SNAL]L
Using this RegExp we can now test every possible word to get matching pattern words
Results
   Â
My responses
- L Bozo
- Mald cope seethe
- Cry about it
- If you wish to defeat me train for another 100 years
- Get rekt
Revamp
Fast forward about new Range(6, 12)
months and I'm in a
state where
"there's a lot to do"
but at the same time
"there's nothing to do"
The previous solution involved me putting my patterns into an ugly json config file, so I can't really visualize the pattern itself
What I really need as an individual is the ability to absolutely annihilate any foes, can't afford to spend 10 mins inputting the pattern by hand
Some self convincing later I decided to write a little web app to intuitively run the search
There was an attempt to use a JavaScript Framework
but I quickly figured that it just added boatloads of complexity
Alpine.store()
pfftt
I also found this cool github repo that had an actively updated list of Wordle words so I just fetched that everytime the page loaded
After
- One full rewrite of the search algorithm
- A lot of failed attempts to use Flexbox
- Some trial and error color picking
- A lot of time spent setting up Grid
- A fierce battle with
The Form Completion API
I could finally rest in peace knowing that I would win any future Wordle pattern challenges
Lil' Roadblock
While rewriting the search algorithm I found out that wordle won't mark repeated letters as yellow, so I had to move from the RegExp solution to an imperative one that worked almost similar (if you want to see how it works check out the source of the embed)
Final Results
Or you can use it right here