/ blog

: Aaron Sparks | : 2020-01-21 | : python, ny times, games, spelling bee, word games


NY
Screenshot of one of the HTML/Jinja templates for this website. (Photo credit - Aaron Sparks)

My wife and I have been playing the NY Times' Spelling Bee game and got hooked. The basic outline of the game is around building words from a center "required" letter and 6 surrounding letters that are arranged in a hexagonal configuration. You get points for every word. And bonus points for longer words.

Sometimes, the puzzles are quite hard and it's frustrating to not know the words that would have taken us to the coveted "genius level"! I'd really like for the NY Times to publish the answers the following day. Since they don't do that, I decided to build a Python program to provide the answers.

I pulled a dictionary file off of Github and modified it to make the processing go more quickly. First, I removed all words with fewer than 4 characters (per the NYT rules). Next, I added an alphabet array to each word and flagged whether the character was present in the word or not. Then I removed all words that use more than 7 letters of the alphabet (as the game limits you to 7 unique letters).

The alphabet array is used to quickly identify the letters that are not in the daily puzzle. I then print two lists - 1) all possible answers (sorted by length) and 2) the panagrams (i.e. words that use all 7 letters).

Check it out on Github - NY Times Spelling Bee Solver.


Like the blog post? Spread the word!
         

about aaron

Foo
Here's a brief rundown on the author of this blog and contact info if you want to reach out.