Question: MATLAB Clock game Write a program that will function as a simple clock game. The program will determine a random target between 5 and 15

MATLAB Clock game

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

Indicate 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

Anyhelp on where to start with this would be much appreciated or showing an example.

On how the time is calculated all my professor said was that I could use the randi commmand along with another to get it to calculate the decimal times.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!