Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your Simon game must have the equivalent of three buttons. We recommend using integers (e.g., 0, 1, 2) for this so that each round involves
Your Simon game must have the equivalent of three "buttons." We recommend using integers (e.g., 0, 1, 2) for this so that each round involves printing a sequence of numbers and having the user repeat this sequence, one number at a time, and then having the user type an additional number, but if to use characters (e.g., 'r', 'g', 'b'), you may use them instead. To make your button equivalences more clear to a user, please have your program start with a message similar to the following: "Welcome to the Simon game. Sequences will be made up of numbers 0, 1, and 2." The first round of your game must present only one number (or character) for the user to repeat. The user should be asked to repeat this 'sequence' and to add an additional number. Each subsequent round must present the same sequence to the user as that in the prior round with two additional numbers (or characters) at the end: (1) the number/character that the user added to the end of the sequence in the prior round and (2) a randomly generated new number/character. Note that at the beginning of round n, the sequence that will be presented to the user should be of length 2n - 1 and at the end of the round (when the user types a sequence back), the sequence length should be 2n (as the user has added a number to the sequence). The game must end as soon as a number (or character) in the sequence is incorrect. For example, if the user needs to repeat a sequence of length 5, but enters an incorrect number in the middle of the sequence, the game should end at that point rather than waiting until the user enters all numbers. The game must also end if the user selects an ineligible number to be added to the end of the sequence (i.e., trying to repeat the last number or adding a number that doesn't exist in the game). Your Simon game must be able to last for at least 6 rounds. After 6 rounds, it is okay to directly say that the user wins rather than requiring the game to continue until the user fails. Each time you run the program, the user should be presented with a different sequence (so you will need to be able to randomly generate the numbers to be filled into the computer-generated portions of the sequence)
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