β¨ No spoilers here β¨
On Jan 01, 2022 β while on vacation, I reverse engineered and hacked the Wordle game. π
Then I built three little tools for developers and non-developers to solve Wordle however they prefer.
Oh, such fun, much luck!
It all started with Inspect Element :)
Playing Wordle was fine but I enjoyed building a CLI to solve the damn thing, even more.
Looking under the hood I found no relevant API requests.
For a while, I was: meh Β―\_(γ)_/Β―
The AHA moment:
Before going down the rabbit hole β¦
I looked for the client-side state. Lo and behold.
To my surprise, the solution was right there in the localStorage. π₯³
Haha!!!
The OMG. WTF? BBQ! moment.
No network requests.
Gameβs solution in localStorage.
What if there's more. Hint: there was a lot more!!
Found an array of 2,315 wordle words in the client-side code. Woohoo! π₯³π₯³π₯³
Look at this beautiful array β
Figuring out the algorithm:
Skimmed through over 15,625 lines of code, found:
π function to get word index
π function to get start and today's date diff
Oh, such fun, much luck! I was golden.
Rewrote the algorithm to something like this β
#1: Wordle Solved JavaScript Bookmarklet!
Make a new bookmark in your browser (right-click on the bookmarks bar and click Add Page β use the code below from my blog β Awais.dev/wordle/
β¨ Clicking on the bookmark will show you the solution.
#2: Wordle-solved Chrome Extension
Looking for a more fancy solution, with the words listed for yesterday, today, and tomorrow β well, itβs your lucky day. I built a Chrome extension called wordle-solved. I love those animations. Yay!
π github.com/ahmadawais/wordle-solved/
#3: wordle-solved-cli Coz why not?!
I didnβt stop there, hehe β went ahead and built a CLI using create-node-cli, which tries to mimic the same UI in the terminal for all yβall terminal junkies like me.
π Install it globally `npm i -g wordle-solved-cli`
π Run `wordle`
π₯³
Read this story in more detail on my blog:
π Awais.dev/wordle/
π Hello, it's Awais. Nice to e-meet you; I love creating automation tools with JavaScript.
Enjoyed this thread? Follow @MrAhmadAwais for more.