Question: Write a MATLAB program that can guess any integer number between 0 and 1000 within 10 tries and allow the player to play the game


Write a MATLAB program that can guess any integer number between 0 and 1000 within 10 tries and allow the player to play the game over and over until he/she wishes to quit. 15 pt) The MATLAB program should contain the following features: 1. The program will start with greetings and ask the player to write down an integer number between 0 and 1000 on a piece of paper (2.5 pt. 2. The program should wait for the player to be ready. After the player writes down an integer number, the player should be able to press any key to continue the game 3. Make the first guess. The first guess value should always be 500 (2.5 pt), 4. Print the integer value guess by the program in the command window 15 pt), 5. Print the number of tries has made by the program in the command window is be), 6. Ask the player to input if the guess value is too low, too high, or just right. For example, 1 = too low, 2 = too high, 3 = just right. The program should clearly explain to the user how to play this game in the command window 15 pt), 7. If the program guesses the value too low 15 pt): a. Pick another integer in the middle of the guess value and the potential maximum value 15 pt). b. Increment the number of tries the program makes is pt) 8. Else if the program guesses the value too high 15 pt); a. Pick another integer in the middle of the potential minimum value and the guess value is pt) b. Increment the number of tries the program makes is pu). 9. Else if the program guesses the value just right spel: a. Print the number on the player's paper in the command window 15 pt. b. Print the number of tries the program made to successfully guess the value in the command window 15 pt] 10. Otherwise, the player's input is none of the above: a. Remind the player how to play this game 15 pt) 11. The program should keep guessing a number, using the "honest hint provided by the player; track the number of attempts it has made (keep repeating steps 4 through 10), until the player says that the program guesses correctly (5 p. 15. If the player would like to play again, the program should wait for the player to write down a new number on a piece of paper, try to guess the new number, and repeat steps 1 through 14 until the player decides to stop playing 16. When the player selects to stop playing, say good-bye to the player and end the program 12.5 pt) [5 pt)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
