Cheating Hangman
September 26, 2019 8:32 AM   Subscribe

Cheating Hangman
I made a game of Hangman that "cheats" by changing the word it's thinking of in order to make it as hard as possible to guess. But while it cheats, it never lies: it remains consistent with what it's told you so far about the word length, matching letters, non-matching letters etc.

I was originally inspired by Nick Berry's excellent analysis of hangman strategy, many years ago. I reversed his procedure to instead come up with the hardest words to guess when playing hangman. But then just this week, a conversation with a work colleague got me thinking: what would a game of hangman be like if the hangman was allowed to cheat?

The game works by jumping in between you making a guess and it telling you whether or not the guess is correct. It considers all of the possible words that it could have been thinking about and "switches" to the one that maximises the number of guesses it expects you to have to make. I've written a blog post with more detail about its strategy and what it feels like to play it and I've open-sourced the whole thing.

It needs a pretty modern browser to work; sorry if your mobile phone isn't up to the challenge. Good luck!
Role: Programmer
posted by avapoet (8 comments total) 10 users marked this as a favorite
This project was posted to MetaFilter by jacquilynne on September 30, 2019: Tsktsk!

I love everything about this - it even tells me when I mess up and guess the same letter twice!
posted by exogenous at 11:52 AM on September 26 [2 favorites]


And thus it was, on the last day of September, 2019, that the AI known as the Cheating Hangman became self-aware.

And the world was changed forever.
posted by sugar and confetti at 12:22 PM on September 26 [1 favorite]


God it's absolutely horrible. Well done.
posted by Sokka shot first at 1:32 PM on September 26 [4 favorites]


Also, I really enjoyed the hangman strategy piece you linked to, although there's still something about his strategy I'd push back on (for human players): I'd wager humans are better at pattern recognition in hangman when it comes to consonants, less so with vowels. For the word basic, I feel like B___C is easier than _A_I_. He lays out a strong optimal strategy for guessing the most letters in the fewest tries, but then what? Are those letters necessarily the best letters to help you work out the rest of the word?

Anyway, I like your awesome thing a whole lot and it's super fun.
posted by sugar and confetti at 5:22 AM on September 27 [1 favorite]


Indeed, sugar and confetti, you're absolutely right (a fact that's very clear when playing Hangman against any kind of computer player): cognitive factors are absolutely something that really affects how "hard" a game of Hangman is for humans. Those aren't accurately reflected in the difficulty curve of Cheating Hangman or any other computerised hangman game I've seen.

Another bias I find, when I'm playing, is that it's easier to think of words-that-start-with something than words-that-end-with something. For example, looking at 6-letter words in Cheating Hangman's dictionary, there are 27 of them that end with "-YING". There are only 23 that begin with "BAS-". But I'll bet that you can think of more of the latter than the former given 10 seconds on each, right? For me, at least, it feels as though words might be stored somewhat like a linked list in my mind, with each syllable hanging-off the one that preceded it. Similarly, playing I Spy with items whose second and third letters are specified instead of their first introduces a significantly heavier cognitive load!

I think you're right about consonants. It's probably also true that letters that touch one another, especially if their presumed-sound matches the sound they make in the completed word, help too. I'm really interested in the linguistics of how this affects games in other languages (e.g. in highly phonetic ones like Welsh, Russian, or Lojban), but unfortunately I've neither the time nor talent to research it further.
posted by avapoet at 8:16 AM on September 27 [1 favorite]


This is brilliant. My eventual arrival at "tsktsked" was honestly wonderful.
posted by Nossidge at 9:09 AM on September 27 [3 favorites]


I was just checking my Recent Activity, saw Nossidge's comment and went for another game: the result
posted by exogenous at 5:50 AM on September 28


That is evil and wrong and ridiculous and great.
posted by jacquilynne at 10:23 AM on September 30


« Older In The Terminals Of Minraud...   |   making/upcyling jewelry outta ... Newer »


You are not currently logged in. Log in or create a new account to post comments.