Question
You will be creating a game in C++ for your Arduino called Time bomb. The game randomly generates a disarming code and gives the player
You will be creating a game in C++ for your Arduino called "Time bomb." The game randomly generates a disarming code and gives the player a 25-second time limit countdown to 0. The countdown is displayed on the 8-segment display from 0025 down to 0000. The disarming code is input by the player using the three pushbuttons (A1, A2, and A3). The disarming code is some random combination of these buttons. For example, if I generate a code of 0, 2, 2, 1, then I must press the left button, the right button twice, and then the middle button to disarm the bomb. If I do not press the correct button, the player must enter the code starting from the beginning. Every time the user presses the correct button, you will light an LED from bottom to top. If the user presses the wrong button, then clear all LEDs so the user can start over again. The player wins by lighting all four LEDs, meaning they inputted the correct 4-button sequence. If the user presses the correct four button sequence, display dashes (----) for 3 seconds, and then start the game from the beginning. If the user does not press the correct four button sequence and the time limit counts down to 0, then you will display all zeroes (0000) for 3 seconds. During these 3 seconds, sound the buzzer (pin 3) to simulate a "time bomb" sound. After the 3 seconds, restart the game with a new, random, 4-button disarming code and 25-second time limit.
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