Hangman is a traditional children's game, typically played with words. It's possible, however, to play Category Hangman --- rather than guessing words the player might guess names of cities, or athletes, or fictional characters, names of lego minifigures or top forty song titles --- the list is endless. To play online try hangman.no for some fun.
You'll be writing a program to play a "guess a word letter-by-letter" version of hangman as shown below and decribed in detail in the howto pages. We'll also see how to translate the Python code students write into a version that will play on the web using other languages. This program will also be the basis for writing a "cheating hangman" that essentially almost never loses (by cheating, though you, the guesser, won't know that.)
According to this article the hardest words to guess in hangman are jazz, buzz, and jazzed if you lose with 8 misses though with 11 misses allowed jazzed is apparently harder to guess than buzz.
For the standard word-oriented hangman the user should be allowed to specify the number of letters in the word and the number of misses until the game is lost (see the sample runs below for details). The program should be reasonably robust in the face of faulty input from the user, though don't go overboard in writing code to protect against bad input.
Details and guidelines of how to organize the program, including the methods you should write, are describd in the howto pages. It's important to adhere to these guidelines.
In the run below the user input is in italics, the other text is printed by the program.
# letters in word: 8 # guesses to hanging: 7 _ _ _ _ _ _ _ _ misses left: 7 guesses so far: guess letter: e no e _ _ _ _ _ _ _ _ misses left: 6 guesses so far: e guess letter: a no a _ _ _ _ _ _ _ _ misses left: 5 guesses so far: a e guess letter: o no o _ _ _ _ _ _ _ _ misses left: 4 guesses so far: a e o guess letter: u no u _ _ _ _ _ _ _ _ misses left: 3 guesses so far: a u e o guess letter: i _ _ _ i _ _ i _ misses left: 3 guesses so far: a u e o guess letter: s no s _ _ _ i _ _ i _ misses left: 2 guesses so far: a e o s u guess letter: t no t _ _ _ i _ _ i _ misses left: 1 guesses so far: a e o s u t guess letter: r _ _ r i _ _ i _ misses left: 1 guesses so far: a e o s u t guess letter: n no n you are hung :-(, secret word is cyrillic
Submit using the submit name hangman.