CSCI 261 - Programming ConceptsFall 2018 - A5 - HangmanQuick Links: Canvas | Mines | Piazza | zyBooks |
|||||||||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | |||||||||||||||||
This assignment is due by Thursday, October 18, 2018 11:59 PM. · Instructions · Rubric · Submission · This assignment exercises your ability
to use conditionals, loops, arrays, and functions together.
Instructions
Your goal for this assignment is to create a playable Hangman game. You will
need to create a secret word for the user to
try and guess one letter at a time.
First you need to ask the
user to enter a letter. Then you'll check if that letter exists in your
secret word. If it does exist, then you should tell the user and
display the puzzle with the letter revealed. If the letter does not
exist, then inform the user that the letter is not found. You will repeat this
process until all the correct letters have been guessed or the user has
entered 7 wrong letters.
Hopefully it is readily clear that you
will need to use a loop to keep prompting the user to enter a letter.
You will also need to use conditionals to check if the letter exists.
You will need to use an array to store the secret letters (since a word
is just a collection of letters). We'll also need arrays to keep track
of the previously guessed letters (we don't want the player to guess
wrong a second time) and the solved letters.
An example of a winning game:
Welcome to Hangman!!
Take a guess: _ _ _ _ _ _ _ _ _ _ _ Your guess: a There's a A! Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: c Sorry, no C's. You have 6 wrong guesses remaining. Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: a You already guessed A. ... Take a guess: P R O _ R A M M I N _ Your guess: g There's a G! CONGRATS! You solved the puzzle: P R O G R A M M I N G
An example of a losing game:
Welcome to Hangman!!
Take a guess: _ _ _ _ _ _ _ _ _ _ _ Your guess: a There's a A! Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: c Sorry, no C's. You have 6 wrong guesses remaining. Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: q Sorry, no Q's. You have 5 wrong guesses remaining. Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: a You already guessed A. Pick again. Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: q You already guessed Q. Pick again. ... Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: w Sorry, no W's. You have 1 wrong guess remaining. Take a guess: _ _ _ _ _ A _ _ _ _ _ Your guess: X Sorry, no X's. You lose. Try again! Hints
Functional Requirements
Grading RubricYour submission will be graded according to the following rubric.
This assignment is due by Thursday, October 18, 2018 11:59 PM. SubmissionAlways, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available. The following instructions are copied from How to Submit Homework. It is critical that you follow these steps when submitting homework.
If you do not follow these instructions, your assignment
will receive a major deduction. Why all the fuss? Because we have
several hundred of these assignments to grade, and we use
computer tools to automate as much of the process as possible.
If you deviate from these instructions, our grading tools will
not work. And that makes us very unhappy. And when we're
unhappy, we give penalties. Thus, make us happy.
Submission Instructions Here are step-by-step instructions for submitting your homework properly:
In summary, you must zip the
"Set5" folder
and only the "Set5" folder, this zip folder must have several sub-folders, you must name all these folders correctly, you must submit the correct zip file for this
homework, and you must click the "Submit Assignment" button. Not doing these steps is like bringing your
homework to class but forgetting to hand it in. No concessions will be made for
incorrectly submitted work. If you incorrectly submit your homework, we will not be able to
give you full credit. And that makes us unhappy. This assignment is due by Thursday, October 18, 2018 11:59 PM. | |||||||||||||||||
Last Updated: 09/28/18 23:12
|