Run update21, if you haven't already, to create the cs21/labs/07 directory. Then cd into your cs21/labs/07 directory and create the python programs for lab 7 in this directory (handin21 looks for your lab 7 assignments in your cs21/labs/07 directory):
$ update21 $ cd cs21/labs/07Your programs are graded on both correctness and style. Please review the comments regarding programming style on the main page. In particular, each function needs a comment.
For this assignment, you will write a program that implements the hangman game (you can use the "apples falling from the tree" alternative if you want). The focus of this assignment is for you to practice using top-down design to construct your solution incrementally.
Hangman is a simple letter guessing game. The computer picks a word (from a file) and displays it with underscores replacing the letters. The user tries to figure out the word by guessing one letter at a time. The user loses if they guess too many incorrect letters.
This assignment will span two weeks. In the first week, you will be required to design your solution and implement minimalistic function stubs for your design. In the second week, you will finish implementing and testing your design.
Note: Once you have your top-level design
done you need to run handin21 and send me an email that you
have completed your top-level design. I will look at your design
and email you with feedback on your design within 24-48 hours. The
earlier you handin your design, the earlier you can continue working
on your full program. I would suggest you wait to hear back from me before
continuing on your program because if I suggest you do something
differently, you may have to redo some of your code.
For the design of a program in the first week, you should have:
Here are two examples of how your hangman program should work.
if 'a' in mystring: ...Use not in to test if a character is not in a string.
>>> word = "apple" >>> charList = list(word) >>> print charList ['a', 'p', 'p', 'l', 'e'] >>> rejoined = ''.join(charList) >>> print rejoined 'apple'
word = "apple" charList = list(word) print ('a' in charList) #prints True
Extentions are not a required part of lab 7, but you may want to try adding some once you get the required part implemented and tested.
Note: if you implement one or more extra features, include in the comment at the top of your file a description of the extra feature(s) you added, and tell us how to test your feature if it is like one of the first three. If we need any special input files to test your extra feature, you should include those in your lab07 directory when you submit your solution.
Here are some fun extensions that you might want to add to your program:
________ |/ | | (_) | \|/ | | | _/ \_ | ____|____
Once you are satisfied with your programs, hand them in by typing handin21 at the unix prompt.
You may run handin21 as many times as you like, and only the most recent submission will be recorded. This is useful if you realize, after handing in some programs, that you'd like to make a few more changes to them.