The document provides guidelines and an algorithm for a Hangman game. It allows 9 lives for guesses of 5 letter words, showing a clue with '?' for unguessed letters. As correct letters are guessed, '?' are replaced; if the word is guessed or lives run out, it displays a win or loss message with the secret word. The algorithm sets lives to 9 and a random secret word, then loops while lives remain - showing the clue, getting a guess, updating the clue or deducting a life for incorrect guesses, and exiting to display the result.
The document provides guidelines and an algorithm for a Hangman game. It allows 9 lives for guesses of 5 letter words, showing a clue with '?' for unguessed letters. As correct letters are guessed, '?' are replaced; if the word is guessed or lives run out, it displays a win or loss message with the secret word. The algorithm sets lives to 9 and a random secret word, then loops while lives remain - showing the clue, getting a guess, updating the clue or deducting a life for incorrect guesses, and exiting to display the result.
The document provides guidelines and an algorithm for a Hangman game. It allows 9 lives for guesses of 5 letter words, showing a clue with '?' for unguessed letters. As correct letters are guessed, '?' are replaced; if the word is guessed or lives run out, it displays a win or loss message with the secret word. The algorithm sets lives to 9 and a random secret word, then loops while lives remain - showing the clue, getting a guess, updating the clue or deducting a life for incorrect guesses, and exiting to display the result.
1. Users will be allowed 9 lives or tries for guesses
2. You can use a set of 5 letter words 3. You are to show them a clue with ‘?’ in place of the letters 4. As each correct letter is guessed, the ‘?’ will be replaced with the correct letter 5. Once all correct letters are guessed or the actual word is guessed then you are to display ‘ You won. You guessed the secret word __________.” 6. Else you should display “ You lost. The secret word was __________.”
Algorithm:
1. Lives set to 9, secret_word set to random choice from the list
2. While lives > 0: 3. Show the clue ( Word with ?????) 4. Wait for user’s guess 5. If guess letter in word, show updated clue 6. If guess letter not in word say incorrect, life - 1, show lives: 7. If all letters guessed, no more ? then exit and congratulate 8. If not able to guess, then ‘ You lose. Secret word was _______.’