blog

consistent inconsistency

i made a boggle solver (last year)

I started writing this post at the end of 2025... and forgot to finish or post it. Oops!

tl;dr - I made a web app for Boggle lovers! Take a photo of the board and see all the words you could have found on it. It runs completely in browser.

/blog/uploads/1000041431_1_large.png

Growing up, Boggle was a staple in our house. My brother and I still have a playful (maybe?) but fierce rivalry over who is the best at the game. A quick primer for those that might not have had such a "learning is fun!" upbringing: Boggle is a word game where the aim is to find the most unique words on a 4x4 grid of letters with a 3 minute timer. Longer words score more points!

One question I always have after a round is whether we found the best words on the board. I'm sure the answer is usually no, and there are six, seven, or even eight letter words hiding in there.

If you have a list of allowable words1, it's fairly easy to create an algorithm that will find all of the words on the board. If you haven't tried to implement this algorithm before, it's a fun puzzle! I was even asked to implement it in an Amazon technical interview.

Obviously you can just do an exhaustive search, but it can be made much more efficient by using a data structure that lets you efficiently check if a string is a prefix of any of the words, such as a trie/prefix tree. Then the algorithm is:

  1. Create an empty set for found words
  2. Pick a starting letter and start with an empty string, then:
    1. Add the letter to the string
    2. Check if the string is a word
    3. If it is, add it to the set
    4. Check if the string is a prefix
    5. If it isn't, return
    6. Recurse on any unvisited adjacent letter
  3. Repeat for all starting letters

I've tried to make an app that implements this algorithm and use it in between rounds of Boggle before, but my implementations always required manually typing in the letters from the board, which is quite clunky. For years I've had this vision of an app that would let you take a picture of the Boggle board, recognise the letters, then show you all the words, but it's always seemed slightly out of reach. But recently my brother reminded me of this idea, and I decided to see if I could implement it as a weekend project.

It was a fun romp through writing a lot of bad Javascript, understanding how the ONNX runtime works on the web, doing image processing in browser, and making some fun tools to do data collection. This was also the first project (this was in late 2025) that I really leant on AI tools (specifically ChatGPT) to help with my coding. A lot has changed since then!


  1. Getting this list right is surprisingly hard: too many words and some of them don't seem "real" as they're so uncommon; too few words and you miss words you think should be there! 

tags: projects, ai, coding, games, boggle

permalink | posted by nathan on Wednesday, the 16th of September, 2026, when he should have been sleeping