Answered step by step
Verified Expert Solution
Question
1 Approved Answer
solve in matlab and uplode the code, and show up the steps please Part A: Hangman In this part you will implement a simple game
solve in matlab and uplode the code, and show up the steps please
Part A: Hangman In this part you will implement a simple game of Hangman. When a user plays hangman, the computer first selects a secret word at random from a list of words built into the program. The program then prints out a row of dashes. One for each letter in the secret word and asks the user to guess a letter. If the user guesses a letter that is in the word, the word is redisplayed with all instances of that letter shown in the correct positions. Along with any letters correctly guessed on previous turns. If the letter does not appear in the work, the user is charged with incorrect guess. The user keeps guessing letters until either the user has correctly guessed all the letters in the word, or the use has made 6 incorrect guesses. A sample run that illustrate the play of the game is shown in figure 1. Your Job is to write a MATLAB program that handles the user interaction with the game. Your program must be able to: Chose a random word to use as the secret word, the word is chosen from a word list. Keep track of the user's partially guessed word, which begins as a series of dashes and then gets updated as correct letters are guessed. Implement the basic control structure and manage the details by asking the user to guess a letter, keep track of the number of guesses remaining, printout the various messages, detect the end of the game and so forth. More requirements: Validate the input of the user. The input should only be a single character. Use functions in building the structure of the program. Welcome to Mangan Try to guess the secret word one letter at a time Secret Word Letters Guessedt Guesses remainingas Next quess: Yest Secret Word: Letters Guessed: R Guesses remainings Next guessis Nopet Secret Word Letters Guessed: RS Guesses remaining: 4 Next guess: Yes! Secret Word: Letters Guessede RST Guesses remaining: Next quest Nopet Secret Word Letters Guessed: RST Guesses remaining 3 Next goes Nopet Secret Word Letters Goessed: RSTNE Guesses remaining: 2 Next guess: A Yes! Secret wordt A Letters Guessed: RSTUEA Guesses remaining: 2 Next guess: M Nope! Secret Word:ARAT Letters Guessed: RSTNEM Guesses remainingi Next guessin Nope! Sorry, you lose. The word AS: LABORATORY Figure 1 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started