Press enter or click to view image in full size
TLDR
The minified javascript is below via gist, it didn't like medium formatting, Copy and Paste into a browser bookmark, and instead of a URL, paste the code exactly.
The explanation
A few weeks ago, I developed a simple JavaScript frontend designed to interact with the daily Connection Puzzle. The goal was to format the puzzle data, interface with a middleman API connected to ChatGPT, and employ various models to solve the puzzle. To accomplish this, I wrote JavaScript code that would also submit the results back to the puzzle platform and verify whether the submission was successful or not.
I soon discovered that The New York Times had obfuscated the process for selecting words and submitting each round of four. Intrigued by the challenge and the obfuscated frontend, I delved deeper. After beautifying their source code, it became clear how they triggered certain events. I also discovered where the results were stored on the frontend and how to access the API. This revelation greatly simplified my task. Instead of using frontend methods to fetch the results, I directly accessed the NYT’s RESTful JSON API and pulled data from an extensive JSON payload. The only obstacle was identifying where today’s puzzle ID was stored. Fortunately, I found it in localStorage.
Although I had already written the frontend code to extract words and submit the quiz, I decided to repurpose that effort. I had some additional fun creating a bookmarklet cheat for the puzzle.
In a few weeks, I’ll release the findings from my ChatGPT experiment. Spoiler alert: it turns out that the puzzle creators at The New York Times have been successfully deceiving the AI. Clearly, there’s room for improvement, whether by further training the existing model or by creating a custom model — perhaps a LLaMA model — using historical data to teach the AI how the puzzle tries to mislead users.
Things I should clear up
- It’s cheating. I still play Connections every day, legitimately and I think Wyna Liu has created a lovely game.
- This puzzle could be enforced by backend to prevent all this from happening, I assume the choice not to do so is based on scaling and performance over people like me finding the results
- I did all of this on two train rides (33 minutes apiece) so because of the short windows I gave myself to deliver this, and not intrude on my professional workload & personal life, I used jQuery, which is probably going to keep us all up at night…
- I used setTimeout in a non-dry way to test the time that the NYT uses to animate the various elements which was preventing me from submitting correctly
Bookmarklet (minified):
https://gist.github.com/jahrichie/e41987419bd2dec515e875b2defb44df
JS Source
https://gist.github.com/jahrichie/ab20210cf8c041d9cede344e8e495fbc