215 points · by icefox · 14y ago · 62 comments
That is, S, when it appears, is heavily skewed towards the last letter in the word, finding it won't help you figure out the word nearly as well as finding the more evenly distributed E or A.
For example, which letter do you guess if the puzzle is _og? You still have to go through bcdfhjln even after you've burned however many guesses getting that o & g.
It had one problem in that it always tried to make sure you guessed wrong, but by carefully choosing your letters you could cause it to exclude tons of words because they contained the letter you guessed, leaving only a small number of possible words.
It needed a refinement to occasionally allow you to guess correctly if that maximized the number of possible words remaining that still fit the prior guesses.
Which, for the ispell words list, appears to be 'e' :( edit: which was the solution found for the suboptimal method in the article, and which is not present for words in the corpus 25% of the time
code at http://pastie.org/3693750
To calculate this, take the sum of -p * log(p) for all patterns of the guessed letter, where p is the proportion of words in the candidate set that have this pattern.
That depends on your opponent. In game theory you often assume that your opponent plays against you and as good as they can, so you'd go with the worst case.
Remember, if you pick a correct letter you will not loose any guesses, in other words you get another guess if your guess is right. It's not about finding the word in a fixed number of guesses.
But otherwise you could also extend your method to increase the weight of letters appearing more than once in a word since that gives even more information gain.
The thing is, at least for the dictionaries I had available, trying to weight for information gain only considering the guess correctness wasn't all that great a strategy. Even if you know 100% certain that the letter will be correct, its very likely to still cut the search space down by virtue of the pattern of letters, and in aggregate my strategy made no statistical difference. (+/- 1% depending on random seed).
If I were going to try and improve my scores, I guess the next thing would be look at the distribution of letter-patterns for each remaining letter, but my intuition is that it just wouldn't be a big deal.
Their homepage says this "DataGenetics is a technology consultancy specializing in unlocking the value stored in large databases. Using a variety of techniques we can mine the trends in your data to help you maximize your marketing and advertising campaigns."
Damn.
Yet another group of smart folks focused on more-effective advertising.
This is great if you're playing hangman against a computer. Probably, you're not.
You're playing against a person, who probably has some sense of your strategies.
Even when I was a kid, we didn't play hangman by choosing random words. What's the fun in that? You notice how the other person plays, and in the next rounds you pick words that break their strategies.
You notice they are doing the "common letters" or even "common vowels" strategy, and you give them "lynx".
Or you trick them with a word that has a few easy-to-get letters, but is going to be hard to guess the last few because there are so many possible matching words -- I had a great one that I forget now... maybe "budder"?
Did everyone really play with randomly-chosen words? What a waste.
Of course, this analysis has a counterpoint. If I try to pick words strategically, I suspect that my words would begin to follow patterns...
We did have one minor rule change -- definitely more than 11 line segments to hang the man. If you had a really good word, and wanted to draw out the torture, you'd start drawing in facial features, fingers...
It also adds a bit of artistic fun to the game; you don't even have to be hanging a "man" if you want to get creative; it could be a giant insect, horse, whatever.
It would still be pretty clear who was "winning" by how long the string of crossed-out letters were by each round.
In general, shorter words are harder to guess in hangman.
* assuming as he does at the bottom the existence of a computer.
But right and wrong guesses are not equally valuable in hangman. A wrong guess will eliminate all words of a given length containing the given letter. But a correct guess gives you more: you get the location (or locations) of the letter in the word as a bonus. This will reduce your remaining search space drastically.
Thus, you should optimize for the success of your next guess.
You must somehow weigh information gain against risk.
- you are correct (happens 99% of the time). No penalty, and you find out at which positions your guessed letter occurs, a decent information gain.
- you are incorrect. You suffer a penalty but eliminate 99% of the remaining words, a massive information gain.
How would 50% be preferable in either case?
If we get a hit, it's not just the presence, or not, of the letter, we learn both the number of hits, and the positions of these hits. These are incredibly valuable pieces of information (more valuable that dividing the remaining words into two equal piles).
If we miss, we've carved away and removed the biggest non-possible set of words with one guess.
I look forward to seeing your analysis of how to deal with that :)
Does 'qi' count? http://www.merriam-webster.com/dictionary/qi
I know it counts when playing Words with Friends...
I also think 'za' is valid when playing Scrabble type games, but 'za' technically isn't a word.
I could make good arguments for both "most likely to be present" and "most information gain", so I implemented a mixed strategy. I calculated the information gain (in bits) and the probability of a correct guess, then used a linear combination of them to determine which letter to guess. Additionally, the weights changed over the course of the game so that correct guesses were valued more as incorrect guesses became more scarce.
To determine appropriate weights, I ran a crude Monte Carlo simulation. The final weights I ended up with were 0.60:0.03 with no incorrect guesses and 0.54:0.69 once there aren't any strikes left. (bits information gain : p(correct guess))
I'm not arguing that they are, or are not, words. I'm just saying that they were not in the dictionaty file I used :)
Vs a week player the ideal word list should only include 'common' words.
Vs an ideal player you need to assume they will pick from the list of words that you least likely to guess using optimum play.
Generically, optimum play ends up with a somewhat random list, aka 90% of the time pick E, 10% of the time pick I etc.
PS: Actually generating this list is a 'hard' problem and vary dictionary dependent, but you can probably get reasonably close using some sort of genetic algorithm and a enough simulation time.
Sounds like a challenge. I don't think, given a dictionary, finding the ideal strategy for both parties will be that challenging. It's a fairly straightforward two person zero-sum game. You can either model it assuming hidden information, or concurrent play. (Which is basically the same here.)
As an interesting variation, you might allow the chooser to cheat: I.e. don't make them write down the word in the first place, just require their play to be consistent.
1) A hit or miss of a letter tells you a lot about what the new subsequent optimal guess is. You could make a flow chart (a really big one) that shows you the optimal letter to call out next based on what has hit and missed.
2) the position that a letter has hit tells you a lot about the target word. if you have a computer, the regex becomes trivial to identify the next optimal letter to guess. an 'optimal' table could be generated based off this pattern, and it would be a huge table.
I kept feeling like every step of the way it was an infomercial, 'but wait... there's more!' and I like that, it got me thinking.
I'd love to have my hangman bot go head to head with yours on random words. that would be a fun little project.
Put another way, what are the letters I should guess when I don't know the length of the word?
While it wouldn't be perfect strategy, it would be easier to execute.
We should have a hangman AI tournament.
For example, if I have guess T and E and see _ _ E as the word I know it's not the word "The".