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 US Presidents 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.
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
Snarf the demo files for assignment5. You can also see the files here:
Hangman.py
- write code only in this module! If you did
the extra credit,
include it in here and include a note in your README file that you did the
extra credit.
Include the normally required items for your README file. If you did the extra credit you must mention that in here. Additionally, document any bugs or problems in your program that you were not able to resolve (i.e., there may be certain kinds of words that you know are not handled properly). If you document bugs that you cannot fix, and how you tried to fix them, they will affect your grade far less than bugs we discover in running your program.
Submit the items to the folder assign5-hangman using eclipse/ambient or the websubmit.
Your grade will be based on how well your program functions.