Clock game,how to set parameters
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm given a problem which states this 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 I however do not know how I would set up the 5-15 seconds with all the times for example 6.34 seconds If I could get help with how to set that up ,I could set the rest of the performs up from there Any help would be appreciated Thank you!!
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Clocks and Timers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!