Cloning the NYTimes Spelling Bee Game

Last summer I got obsessed with the NYTimes spelling bee game and ended up writing my own version of it. Here’s the final result (it’s mobile friendly!):

Check out the source code on github! It’s built with:

I’ll admit it’s not nearly as fun as the official version of the game; I’m sure they spend a lot of time curating the letters. Configuring a reasonably good game was one of the most challenging aspects of this project (second to the animations).

My first, short-lived approach to generating games was to arbitrarily pick seven letters, select one at random as the center letter, and search the dictionary for valid words. Of course, this strategy wouldn’t necessarily produce a pangram, and the quality of the word sets varied wildly.

What’s the best way to guarantee every game contains a pangram? Pick the pangram first and then generate the game!

Then a ran into two other issues: offensive and obscure words.

For the first problem, I found a profanity filter package in python. I ran my dictionary through the filter and eliminated all the offensive words, so I wouldn’t have to repeat the process after generating every game, and to avoid checking offensive words into source control.

For the obscure words, I ended up building out a barebones admin UI with CRUD capability for making edits to the generated games:

Admin UI

The game has some other cool features, too:

If you want to play, there’s a live demo. It may take upwards of 30-seconds to become interactive because the backend is hosted on a hobby tier heroku dyno that spins down when it’s not in use. Enjoy!