I like to play Hanging with Friends, and those that I play with are very competitive. I’ve been staying on top, but just barely. I’ve spent a lot of time informally deducing. I wondered if I could write a program to solve the games for me.
Where to start? It seemed like a big task…
There are two distinct activities to solving a hangman game:
- Finding a list of possible words
- Figuring out what letter to guess next
Each can be developed independently and then brought together for an effective solution.
There are many, many ways to do this, but I thought I’d just start hacking away in Ruby and then transition to something else at the pain points. Ater a couple hours of late-night coding, I found the Ruby-only solution to be good enough for personal use.
Part 2 deals with figuring out which letter to guess next
Part 3 focuses on how to find the list of possible words
Part 4 brings them together
Part 5 talks about next steps