Compsci 101, Spring 2016, Hangman
Due: Thursday, March 10 by 11:59pm + 121 minutes
10 points
See the
howto pages for details on starting this project,
code, and so on. The pages here describe in broad strokes what this
assignment is about.
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.
Overview
Write a program to play a console-based, word-oriented (one word) game of
hangman. Then you will write a second hangman program that guesses movie
titles (multiple words).
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 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 described in the howto
pages. It's important to adhere to these guidelines.
Sample Runs
Here are sample runs of Hangman. You do not need to follow the
format exactly, but you should be sure to include
required information.
Click here for sample runs with words
Click here for sample runs with movie titles
Your Task
Snarf the starter files for assignment5. You can also see the files here:
Requirements
There are several parts/requirements to this programming assignment:
Part 1 - Hangman with guessing a word
- You must write the code in
Hangman.py
.
-
The user should have the choice of deciding the length of the word and
the number of misses allowed.
- The secret word generated should be of length 3 or greater.
- After each guess, you should show
- the correct blanks and guesses for the secret word
- the number of incorrect letter misses left
- letters that have been guessed in alphabetical order as a string such
as "aemost".
- You should print a message at the end telling them if they won or
lost, and what the word was.
Part 2 - Hangman with Movie Titles
- You must write the code in
HangmanMovies.py
. Suggest
you copy your code from Hangman.py to get started.
- Read in the movie titles from the file movies.txt and print the number
of movie titles read in.
-
The user should have the choice of deciding the number of words in the
title and
the number of misses allowed.
- The secret title generated can be one or more words.
- After each guess, you should show
- the correct blanks and guesses for the secret title. Be sure to show
blanks between words so you can tell how many letters are in each word.
- the number of incorrect letter misses left
- the number of words in the title that have missing letters
- letters that have been guessed in alphabetical order as a string such
as "aemost".
- You should print a message at the end telling them if they won or lost
and what the movie title was.
Both Parts
- Your program must consist of functions and function calls. There should be
no global variables in your program.
-
Your program must be reasonably robust in the face of user errors, but don't worry
too much about that.
- You must have a comment for each function.
If you write any additional functions, such as a helper function, then these functions must have comments describing the purpose of the function.
What to Submit
-
Please submit the following items to the folder assign5-hangman using
eclipse/ambient or websubmit.
Hangman.py
HangmanMovies.py
- Fill out the README form on the assignment page.