Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSC 201 Submission Date: 08th February, 2020 Marks 30 Part A: Hangman In this part you will implement a simple game of Hangman. When a
CSC 201 Submission Date: 08th February, 2020 Marks 30 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. CSC 201 Submission Date: 08th February, 2020 Marks 30 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
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