I got a homework assignment this week, but I don't really know how to do it. Can someone tell me what should I do for this program? Don't have to show me the program, I just want some hint for that. Like what kind of loops should I used, and I just don't really get this program... Please help me!!
This program will play the game of "Hangman" - wherein the user tries to guess the proper letters forming a word selected by the computer, or by a second user. Each time an incorrect letter is chosen, a new portion of a hanged man is drawn - if the fully hanged man figure is drawn, the user has lost! If, on the other hand, the user guesses the word correctly before then, the user wins.
1. The user should be able to choose between playing against the computer, or against another human. The only difference will be how the word to be guessed is selected: If playing against the computer, the computer will choose from a built-in list of words, picking one of them at random; If playing against another human, the human hangman will type in a word (a string)
2. The user (either the guesser or the hangman) should be asked for the number of incorrect guesses to allow the guesser... within the range 4 to 10 inclusive.
3. Before each guess entered by the user, the program should
1. Display the letters already chosen
2. Display the number of guesses left
3. Display the portion of the word already guessed, inserting an * (asterisk) for each letter not yet guessed.
4. (Optional) Display the hanged man portions already "drawn" - starting with a scaffold, then the head, body, arms, legs, face, etc...
4. The user enters a character; the program will then indicate if an incorrect character was chosen:
1. A letter already chosen
2. Any non-alphabetic character (such as ?, /, 4, $, etc.) (Hint: see documentation on ctypes.h - especially isalpha())
5. If the user has correctly guessed a letter that appears in the word, the displayed word (with asterisks) is updated, replacing the proper asterisks with the correctly guessed letter. For example, if the word were "EAGLE" and the user guessed "E", both the first and last letters would be filled in : E***E.
6. If the user has correctly guessed the entire word without using all of the allowed incorrect guesses, a congratulatory message (and, optionally, bells and whistles!) Should be displayed. If, on the other hand, the user runs out of incorrect guesses, an appropriate message of condolence should be displayed.
7. Upon termination of a game the program should prompt the player if another game is wanted - an 'n' or 'N' will terminate the program, otherwise it will loop back, select another word, and do it all again!!