Inspiration
Like many people on the Internet in 2020, I played Wordle every day. I’m also happy to have new tools to learn random bits of Norwegian. And I’m always happy to have an excuse to build something fun & useful!
Process
Similar to Zipper, this was a side project – and I aimed to keep it that way. Unlike the editors at the NYT, I wasn’t paid to choose a new word every day.
Requirements
- No backend server
- (or other costly infrastructure that needed babysitting)
- Different word every day
- For a given day, everyone gets the same word
With these requirements in mind, it was pretty clear that this would be another single-page React app, and probably hosted on GitHub Pages.
Data
Also similar to Zipper, the first thing to do was source the data. Searching around online took me to various GitHub repos where people had compiled and shared word lists to use, but those were wildly different sizes and states of completion.
Eventually, I wound up on Norway’s Nasjonalbiblioteket 1 site and found
that they have a resource catalog. Plugging ordbank
2 into the
search box took me to the Norsk ordbank – bokmål 2005 data set.
Perfect!
From there, it was a simple matter of selecting all of the five-letter words.
Build the app
Armed with a list of all five-letter words, it was time to build the app. Fetching data and adding buttons is easy enough so I won’t talk about that.
However, I wanted this game to run on autopilot – I can’t be choosing a word every day. I also didn’t want to select one at random on page load – everyone would get a different word (and you’d get a different one every time you refreshed).
My solution was to create a stable reference (defaulting to the current date in
YYYY-MM-DD
format). This would then be hashed with a stable algorithm,
creating some arbitrary number. We can then use this to select a word at
“random”3 and present it to the user.
- Different puzzle every day? ✅
- Everyone gets the same puzzle? ✅
Deploy the app
Just like with Zipper, I tossed this at GitHub Pages and let it do its job.
Reflections
Things I learned in the course of this project:
- I can’t get enough of public data sets ❤️
- Hashing and predictable randomness is nice to have in my pocket