7 ms·
Reverse engineering Wordle
- GycDH6mb 5y ago> It seems like many of the variables are given names that are not descriptive at all to make it a bit more difficult to read. The code is just minimized for prod.. The article as written makes it sound like the developer(s) intentionally wrote their code cryptically, whereas minimization for deployment is fairly standard practice
- tyingq 5y agoHow common is it to have your minifier change symbol/variable names to short ones?
- nilsbunger 5y agoVery common
- spdustin 5y agoClosure Compiler (for JavaScript) does it. With the SIMPLE_OPTIMIZATIONS [0] flag, it will rename parameters for—and variables local to—functions to save space. [0]: https://developers.google.com/closure/compiler/docs/compilation_levels#simple_optimizations https://developers.google.com/closure/compiler/docs/compilat...
- VoidWhisperer 5y agoIt is pretty common. The goal of the minifier is to reduce the size of the file, so taking the function names, variable names, etc and making them as short as possible works towardd that goal
- joek1301 5y agoI just popped open DevTools on an SPA I made using create-react-app with default settings. Sure enough the minified production JavaScript uses shortened variable names. This is default configuration for Webpack, which is pretty widely used throughout (and outside) the React ecosystem. Interestingly you can still view the unminified source, since create-react-app generates source maps by default.
- deergomoo 5y agoPretty much all of them do it. You can’t minify keywords or literals, so that just leaves whitespace, which would be barely any minification at all.
- tyingq 5y agoJsmin cited a typical 50% reduction without touching symbols, though perhaps that's an average that included removing comments.
- 0xfeba 5y agoThat's literally what they are for.
- tyingq 5y agoFor some context, it didn't used to be terribly common. There's a fair amount of minifying that you can do without touching symbol names, though obviously it doesn't help as much as shortening them. The old jsmin cited about 50% reduction, and it didn't touch any variable or class names.
- k3liutZu 5y agoIt's actually pretty standard
- kbelder 5y agoI've seen some minifiers that can restructure your code... replace if{} with a ternary ?: operator or use boolean shortcutting to replace the whole conditional with a ||, and so on. It's supposed to never do anything that actually affects the logic, but that sort of stuff scares me.
- jer0me 5y agoIf they really wanted to hide it, there are some nasty obfuscators for JavaScript: https://obfuscator.io/ https://obfuscator.io/
- HmOh6WbJ 5y agohttps://jsfuck.com https://jsfuck.com is another good one
- sgmoore 5y ago> var Ha = new Date(2021,5,19,0,0,0,0); > My assumption is that this is the launch date for Wordle But not 19th of May 2021, but 20th of June 2021 Every time I look as JavaScript, I find a new reason to hate it.
- rawling 5y agoOnly 50%; the month is zero-indexed, but the day isn't.
- sgmoore 5y agoSo 19th of June 2021.
- rawling 5y agoYup, still annoying, just marginally less so!
- satsuma 5y agoi'd argue the lack of consistency is more annoying, not less.
- replwoacause 5y agoYep. Makes it all the worse.
- dTal 5y agoThat's horrifying.
- returningfory2 5y agoA word of warning for anyone inspecting the Wordle source code: the answers for each day are stored in a list ordered by day. If you search for today's answer, the next word in the list will be tomorrow's answer, etc. Be careful not to ruin the fun by seeing tomorrow's answer in advance!
- nilsbunger 5y agoI figured that was possible; from the UX it was pretty clear it’s all client side. What I would find cool is derivation of the best strategy at any time. Just like blackjack, there should be a “best” move at all times , and it would be cool to measure yourself against that
- matthewfcarlson 5y agoI think there’s been a few of those on hacker news. Let me dig one up
- Reventlov 5y agoThere is this one (from myself) : https://remy.grunblatt.org/static/wordle/wordle.svg https://remy.grunblatt.org/static/wordle/wordle.svg (dynamic version: https://remy.grunblatt.org/static/wordle/ https://remy.grunblatt.org/static/wordle/). It's not optimal at all, but works for every wordle word; it's built by finding the word (guess) that minimizes the maximum size of the possible words (to guess), a bit like Knuth Algorithm for Mastermind. For an optimal strategy, a backtracking solution with pruning / maybe a branch and bound approach would work, but I didn't manage to implement a fast enough implementation for my small 8 threads CPU.
- greenshackle2 5y agoI made one, not the optimal strategy though, I simply minimized the expected number of possible solutions for the next step. I repurposed my Mastermind solver since it's basically the same game. Just like Mastermind, minimax is probably better than what I did, but it does solve every Wordle in at most 5 guesses, on average 3.4 guesses. https://github.com/jbchouinard/untitled-word-game https://github.com/jbchouinard/untitled-word-game https://en.wikipedia.org/wiki/Mastermind_(board_game)#Best_strategies_with_four_pegs_and_six_colors https://en.wikipedia.org/wiki/Mastermind_(board_game)#Best_s...
- eutectic 5y agoI think using the expected logarithm of the number of solutions (entropy) makes more sense from an information theory perspective. I wonder if it works better in practice.
- classichasclass 5y agoThis was good while my wife and I were in the same time zone: we compared guesses and how we got there. Now that she's a day ahead, we can't do that right now (we found this out when she accidentally did a spoiler).
- ec109685 5y agoI’ve temporarily changed my time zone to play a bit earlier a few times.
- kumarharsh 5y agoOne thing I do while playing with people half a world away is to send just the final pattern (Share button copies that to the clipboard). Once both parties have sent their answers, you can share the screenshots :-)
- anyfactor 5y agoI guess I wasn't the only person who tried to reverse engineer wordle because they were stuck on the final try. I thought I would do a programmatic soltion because that was the only win I will be able to get. I did find it interesting that they had all the 5 letter words in the frontend logic.
- t1ber1us 5y agoThis is brilliant
- saneshark 5y agohow long before this is ported to IOS and becomes the #1 grossing game? I'm thinking ketchapp is already on it.
- bnycum 5y agoClones had been popping up lately, but it seems Apple did something about it and banned them. https://www.macrumors.com/2022/01/11/wordle-app-store-clones/ https://www.macrumors.com/2022/01/11/wordle-app-store-clones...
- iamtheworstdev 5y agothere's 3 clones in the app store right now. two are ripping off the Wordle name.
- saurik 5y ago(It already works great on iOS and is currently free.)
- dzdt 5y agoI just hope the wordle developers manage to cash in on their going-viral jackpot without losing it to copycats or spoiling the experience for players.
- deleted 5y ago[deleted]
- giarc 5y agoI believe the developer was interviewed and said he/she has no plans to change the game to make money. If you go to just https://www.powerlanguage.co.uk/ https://www.powerlanguage.co.uk/ (maker of the game) you can see he made other games on Reddit (The Button and Place) and is listed as an artist, product manager, and engineer. I suspect the attention the game has received has resulted in many head hunters reaching out. Think of Wordle as a loss leader for his career.
- dTal 5y agoWow, they made The Button as well? That's amazing. They have considerable talent for going viral, it seems.
- antoniomika 5y agoI made a little change that allowed setting the day's puzzle based on puzzle ID number via a query parameter so you could play previous day's puzzles. Here's the gist with relevant code block if anyone's curious: https://gist.github.com/antoniomika/5ec4741d309cc829a5bc26a53c4089f3#file-main-db1931a8-js-L14435-L14455 https://gist.github.com/antoniomika/5ec4741d309cc829a5bc26a5...
- manceraio 5y agoThis website is crashing Chrome on my Xiaomi :/
- gizajob 5y agoCame here just to post this too - My Motorola is now stuck in an endless loop of chrome crashes because it keeps trying to reload this blog and gets stuck every time, even trying to navigate away crashes chrome. Robert - next time you attack the source of a website, make sure the source of your own website runs properly first.
- palijer 5y agoYeah! Came here to say the same thing, Chrome on a One Plus Six.
- lilac1 5y agoI'm not sure why you'd want to reverse engineer something that isn't trying to hide anything. Just enjoy playing it! I've seen quite a few blogs/tools all trying to surf the wave of Wordle.
- bluesmoon 5y agoFun times. I remember back in the year 2000, during the dot com craze, there was a company in India that built a clone of "Who wants to be a millionaire". It was in beta and there was no real cash or prize involved. They had all the answers stored in the source code. I wrote up a quick perl script to play the game and unfortunately left it running overnight, and in the morning there were complaints from other players asking how I'd reached the top rank so quickly.
- bee_rider 5y agoDid they give you a Most Valuable Tester award?
- qrohlf 5y agoThis is an unusual thing to find myself typing in a HN thread, but this could use a spoiler tag, as I did not expect to have tomorrow’s challenge ruined for me by a technical blog post.
- magneticnorth 5y agoI'm not easily finding the publication date, but for me the article says tomorrow's word is "query", which was actually the word a couple days ago. If that's what you see, too, then I think it's safe.
- ipsin 5y agoThanks, I came here because I also thought Tomorrow Was Ruined.
- brassattax 5y agoIt will be if you run the JSFiddle at the end
- tstrimple 5y agoCouldn't be ruined, that's six letters.
- heyheyhey 5y agoI really wish Wordle would release the daily puzzle where everyone can do it at the same time.
- gizajob 5y agoROBERT! Your website crashes Chrome on Android. Please fix before reverse-engineering anything else.
- thavalai 5y agoI liked this deconstruction of Wordle a lot: https://bert.org/2021/11/24/the-best-starting-word-in-wordle/ https://bert.org/2021/11/24/the-best-starting-word-in-wordle...
- primeradical 5y agoI rebuilt Wordle from scratch using the same word list. There are actually two word lists, one from which they select the answer, and another from which they validate real words. They are just arrays of strings hardcoded in the JS bundle. When you submit a guess, it checks to see if your guess is in either array (or at least that's how I implemented it). And just does some relatively simple string comparison. Your progress is just stored in local storage. You can blow your data away by deleting it via dev tools. My version just lets you try again by refreshing, I'm not storing any data. The viral factor of the original Wordle, IMO, is the share function and the little emoji grid it generates. https://alexmj212.dev/word-guess/ https://alexmj212.dev/word-guess/ Source: https://github.com/alexmj212/word-guess https://github.com/alexmj212/word-guess
- travisporter 5y agoNice port! However it's not letting me re-use a guessed letter, which makes it way harder to guess the answer
- tradertef 5y ago>> The viral factor of the original Wordle, IMO, is the share function and the little emoji grid it generates. Yes, that is really genius. That's what made me to wonder what this game was about.
- ericmcer 5y agoWordle is easy to cheat at. All the validation and past scores are client side, the code and concept is simple, but why would you cheat? No offense to the author but I am kinda confused why someone would even open the inspector and be like: "how is this being done?!"
- _moof 5y ago> I am kinda confused why someone would even open the inspector and be like: "how is this being done?!" Kids these days. When I was young I would disassemble anything with a circuit board. The Nintendo, the garage door opener... parents drew the line at the VCR though.
- ath3nd 5y agoI actually did the same thing a week or so ago, but in a more readable format: https://gist.github.com/lc-nyovchev/c42f09a48364665da26342598bb7d29f https://gist.github.com/lc-nyovchev/c42f09a48364665da2634259... And https://ath3nd.wordpress.com/2022/01/11/about-wordle/ https://ath3nd.wordpress.com/2022/01/11/about-wordle/ The idea with the game is to have fun, not to make it impenetrable for techies (in which case a backend would have been nice)