Question: MATLAB clockgame Write a program that will function as a simple clock game. The program will determine a random target between 5 and 15 seconds.
MATLAB clockgame
Write a program that will function as a simple clock game. The program will determine a random target between 5 and 15 seconds. The player gets to set the direction of the clock either as up (1) or down (2). The player may pause (3) the clock and may end (4) the game. Any invalid input will be indicated by the program. If the player is able to stop the clock within 0.25 seconds of the target, the program will praise the player.
An example of the game is shown below
Your target is 9.06 seconds
Menu:
1. Up 2. Down 3. Pause 4. End
Please choose an action: 1
Total time is 0.00. The target time is 9.06.
Please choose an action: 3
Total time is 7.77. The target time is 9.06.
Please choose an action: 1
Total time is 7.77. The target time is 9.06.
Please choose an action: 3
Total time is 10.26. The target time is 9.06.
Please choose an action: 2
Total time is 10.26. The target time is 9.06.
Please choose an action: 3
Total time is 8.74. The target time is 9.06.
Please choose an action: 1
Total time is 8.74. The target time is 9.06.
Please choose an action: 3
Total time is 9.29. The target time is 9.06.
Please choose an action: 4
Total time is 9.29. The target time is 9.06.
Your time is 9.29 with 9 commands.
Winner! Winner! Chicken Dinner!
You are free to tailor the prompts and the game play. Your program must do the following
Provide the original clock target
Use inputs 1, 2, 3, 4 as described I
ndicate an invalid entry
Update the user as to the time that is on the clock
Display the clock and the number of commands when the player stops the clock
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
