About Hangman
The pencil-and-paper word game, three ways. Each wrong letter adds a line to the gallows; run out of chances and it's too late. Chances sets how many wrong letters are allowed: 6 starts with the gallows already built (as in the Python scripts), 8 or 10 make you build some of it first.
- YOU GUESS: the computer picks a word (Everyday words or Trickier ones, at the length you choose) and you guess letters, by clicking the wooden type or typing on your keyboard. The ledger shows how many words still fit what you've found; tick Show the odds on the keys to see the chance each letter is in it. Enter starts a new word once a game is over.
- IT GUESSES: think of a word and set its length. The computer asks for a letter; click every place it goes in your word (or press NOT IN IT). Keys: N for not in it, 1–9 (and 0 for the 10th) to mark places, Enter to answer. It usually wins.
- SNEAKY: looks like YOU GUESS, but the computer cheats. See below.
THE STORY
Nobody knows quite where Hangman began; it seems to date from Victorian times. Alice Bertha Gomme's The Traditional Games of England, Scotland, and Ireland (1894) describes a forerunner called Birds, Beasts and Fishes, in which a player writes down the first and last letters of an animal's name with crosses for the rest, and the others try to guess it.
This app grew from three Python scripts. Hangman.py picks one of four words and lets you guess letters, but never hangs anyone: there's no limit on wrong guesses. Hangman fm NoStarch.py is the Hangman game from Al Sweigart's book Invent Your Own Computer Games with Python: a list of animals, the gallows drawn in text and six wrong guesses allowed (head, body, two arms, two legs). gangman_gui.py is a windowed version with a button for each letter, seven chances and a face drawn on the seventh, but no gallows.
The sneaky mode is a famous trick usually called Evil Hangman. Keith Schwarz of Stanford University set it as a programming exercise, and it was shared among computer science teachers as one of the 2011 Nifty Assignments.
HOW IT WORKS
The words come from the site's word list (SCOWL, the same one the Word Solver uses; about 112,000 words in all, with a level for how common each is). Everyday words are its two most common levels, about 11,000 words; Trickier adds the next level, nearly 40,000. The word is picked at random, each one as likely as any other.
How it guesses. It keeps every word of your length that still fits the board: the letters shown must match, and no hidden place may hold a letter already tried (it would have been shown). Then it asks for the letter found in the most of those words, so its guess is as likely as possible to be in yours; everyday words count for more, since people tend to think of those. In a test against 900 everyday words with 6 chances it won 92% of games: nearly always on words of 6 letters or more, about four times in five on 4- and 5-letter words, where a few letters fit too many words (bake, cake, fake, lake, make, rake, take, wake…). If your word isn't in its list, it falls back on how common letters are in English.
How it cheats. In SNEAKY mode the computer never chooses a word. It keeps a list of every word that could still be the answer. When you guess a letter, it sorts that list into families by where the letter would go (one family for "not in the word at all") and keeps the biggest family, then shows you whatever that family has in common. Most of the time the biggest family is the one without your letter, so you get a miss. It never lies: everything it shows fits every word still on its list, and at the end it shows you one of them. The ledger's count of words that still fit is the giveaway.
Your words, guesses and answers are never stored and never leave this page.
FURTHER WATCHING AND READING