1. Number and types of inputs: 4 capacitive touch pads 2. How long will the starting...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Number and types of inputs: 4 capacitive touch pads 2. How long will the starting sequence be: 2 lights 3. Describe how your game will show the sequence to the player: show a light to the players 4. Describe what it means for the player to "win" the game: the player is able to recall the colors/ lights 10 times 5. Give your game a name: Flashing Lights 6. Two verification procedures that explain how to test your game to ensure it works properly. One should be for a player that "wins" and the other for a player that "loses". These are instructions for the human player, not for the computer: The player is to touch the touch pads in the order that the lights flashed. If done correctly, another light is added to the sequence. If done incorrectly, all lights flash red. If done correctly all the way to pattern 10, a victory sound plays. 7. Write out the steps of the computer program in a Word document using plain language. For example: "make sound #1" or "check if user guess and current sequence value are the same". This is called pseudocode. These are instructions for the computer: display pattern #1 (flash light 1 blue, then flash light 2 yellow), check if user guess and current pattern is the same, display pattern #2 (flash light 1 blue, then flash light 2 yellow, then flash light 3 red), check if user guess and current pattern is the same... (all the way to pattern #10) a-g is based off the bolded info in 1-7 a. On start, create a variable called sequence and set it equal to an empty array. Create a function called addValue that (1) adds a random number to the end of sequence and (2) writes sequence to the console. Each number should represent an input for your game. For the Simon game, this might be 1=blue, 2=yellow, 3=red, and 4=green. Test the function. b. Modify the code so it uses addValue to generate the starting sequence for your game. c. Write a function called showValue that accepts a number as a parameter and shows this input to the user. For the Simon game, if the parameter was num=1, then the function would light the blue button and play sound #1. If the parameter was num=2, then the function would light the yellow button and play sound #2. Test the function. d. Write a function called showAll that uses your showValue function to show the player the current sequence. If the Simon game sequence was "1, 3, 4" then it would light the blue, then red, then green buttons and play the corresponding sounds. Call this function after you create the sequence. e. Now you will start to write the code that "reads" the player's guesses. For each of your game's inputs, create an event that calls the showValue function. For the Simon game, this would light the blue button and play sound #1 when the user pressed the blue button. f. Now that you can "read" the guess, you need to compare it to the sequence. The variable sequence is an array with indices 0, 1, 2, ..., length-1. If the Simon sequence was "1, 3, 4", then index 0 of the sequence would be "1", index 1 would be "3", and index 2 would be "4". The total length of the sequence is 3. To track where we are in the sequence, we will use a variable called sequencelndex. i. Set the sequencelndex variable to 0 (zero) at the end of your showAll function. ii. Create a function called checkGuess that accepts a number as a parameter. The parameter will represent the input that the user guessed. For the Simon game, if the user guesses the blue button, the parameter would be 1. Use this new checkGuess function to compare the user guess (input parameter) to the correct value (value stored in the sequence variable at the sequencelndex index). 1. If they match, write "CORRECT!" to the console and increase the value of sequencelndex by 1 (one). The program is now ready to accept a guess for the next value in the sequence. 2. If they do not match, write "WRONG!" to the console. Communicate to the user that they lost the game, then set sequence to an empty array. g. Now, modify the checkGuess function to check if the player completed the sequence. If they did, make the sequence longer and show the user the new sequence (hint: you already wrote this code). 1. Number and types of inputs: 4 capacitive touch pads 2. How long will the starting sequence be: 2 lights 3. Describe how your game will show the sequence to the player: show a light to the players 4. Describe what it means for the player to "win" the game: the player is able to recall the colors/ lights 10 times 5. Give your game a name: Flashing Lights 6. Two verification procedures that explain how to test your game to ensure it works properly. One should be for a player that "wins" and the other for a player that "loses". These are instructions for the human player, not for the computer: The player is to touch the touch pads in the order that the lights flashed. If done correctly, another light is added to the sequence. If done incorrectly, all lights flash red. If done correctly all the way to pattern 10, a victory sound plays. 7. Write out the steps of the computer program in a Word document using plain language. For example: "make sound #1" or "check if user guess and current sequence value are the same". This is called pseudocode. These are instructions for the computer: display pattern #1 (flash light 1 blue, then flash light 2 yellow), check if user guess and current pattern is the same, display pattern #2 (flash light 1 blue, then flash light 2 yellow, then flash light 3 red), check if user guess and current pattern is the same... (all the way to pattern #10) a-g is based off the bolded info in 1-7 a. On start, create a variable called sequence and set it equal to an empty array. Create a function called addValue that (1) adds a random number to the end of sequence and (2) writes sequence to the console. Each number should represent an input for your game. For the Simon game, this might be 1=blue, 2=yellow, 3=red, and 4=green. Test the function. b. Modify the code so it uses addValue to generate the starting sequence for your game. c. Write a function called showValue that accepts a number as a parameter and shows this input to the user. For the Simon game, if the parameter was num=1, then the function would light the blue button and play sound #1. If the parameter was num=2, then the function would light the yellow button and play sound #2. Test the function. d. Write a function called showAll that uses your showValue function to show the player the current sequence. If the Simon game sequence was "1, 3, 4" then it would light the blue, then red, then green buttons and play the corresponding sounds. Call this function after you create the sequence. e. Now you will start to write the code that "reads" the player's guesses. For each of your game's inputs, create an event that calls the showValue function. For the Simon game, this would light the blue button and play sound #1 when the user pressed the blue button. f. Now that you can "read" the guess, you need to compare it to the sequence. The variable sequence is an array with indices 0, 1, 2, ..., length-1. If the Simon sequence was "1, 3, 4", then index 0 of the sequence would be "1", index 1 would be "3", and index 2 would be "4". The total length of the sequence is 3. To track where we are in the sequence, we will use a variable called sequencelndex. i. Set the sequencelndex variable to 0 (zero) at the end of your showAll function. ii. Create a function called checkGuess that accepts a number as a parameter. The parameter will represent the input that the user guessed. For the Simon game, if the user guesses the blue button, the parameter would be 1. Use this new checkGuess function to compare the user guess (input parameter) to the correct value (value stored in the sequence variable at the sequencelndex index). 1. If they match, write "CORRECT!" to the console and increase the value of sequencelndex by 1 (one). The program is now ready to accept a guess for the next value in the sequence. 2. If they do not match, write "WRONG!" to the console. Communicate to the user that they lost the game, then set sequence to an empty array. g. Now, modify the checkGuess function to check if the player completed the sequence. If they did, make the sequence longer and show the user the new sequence (hint: you already wrote this code).
Expert Answer:
Answer rating: 100% (QA)
Lets break down the problem step by step and provide explanations for each part a On start Create an empty array called sequence Define a function called addValue that Generates a random number repres... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Read the case study "Southwest Airlines," found in Part 2 of your textbook. Review the "Guide to Case Analysis" found on pp. CA1 - CA11 of your textbook. (This guide follows the last case in the...
-
A specialist in the Human Resources department of a national hotel chain is looking for ways to improve retention among hotel staff. The problem is particularly acute among those who maintain rooms,...
-
We consider and simulate the supply chain under a wholesale price contract. As mentioned, we use a retail price of $10, a unit production cost of $2.50, and a (monthly) demand that is normally...
-
Costs of Float Purple feet wine, Inc., receives an average of $11,000 in checks per day. The delay in clearing is typically four days. The current interest rate is .016 percent per day. a. What is...
-
The shareholders' equity accounts of Kanada Inc. at September 30, 2013, are as follows: Preferred shares, $5 noncumulative, unlimited number authorized, 6,000...
-
Surface tension: (a) Acts in the plane of the interface normal to any line in the surface (b) Is also known as capillarity (c) Is a function of the curvature of the interface (d) Decrease with fall...
-
Toddler Toys produces toy construction vehicles for young children. Plastic pieces are molded in the plastics department. These pieces are transferred to the assembly department, where direct...
-
Write a program to check whether the given input is digit or lowercase character or upper case character or a special character (use 'if-else-if' ladder)
-
corporation is resisting the personal holding company tax, but the Tax Court sides with the IRS. Within 90 days after the adverse decision, one shareholder transfers his stock and $10,000 in cash to...
-
The cause of the sea breeze is Options: 1) Radiation 2) Conduction 3) Convection 4) None of the above
-
You are the Manager for a local 24 hour pharmacy store. You hired Maria about two months ago as the Night Shift Lead. Overall her performance has been good. She has a good manner with customers, and...
-
(a) What is an efficient market? What are the consequences of market efficiency for the behavior of stock prices? Does recent research support the idea that the stock market is efficient? (b)...
-
The topic is Importance of Recruitment Strategies I need to mention these three questions in very detailed with citations/refrences from websites. Please include the websites being spoken. Needs to...
-
Alignment of HR practices with company mission (3-4pgs): How well is Bank of America's compensation packages tied to performance management practices? Specifically, to what extent is Bank of...
-
Describe what a financial feasibility analysis is, explain its importance, and discuss the most critical issues to consider when completing this analysis?
-
In the competitive market for widgets there are 125 identical consumers. Each individual consumer has the following demand function for widgets: qP (P) = 5 - F 5 where q is the quantity an individual...
-
Why is homeostasis defined as the "relative constancy of the internal environments? Does negative feedback or positive feedback tend to promote homeostasis?
-
In this exercise, we explore the concept o f marginal rates of substitution (and, in part B, its relation to utility functions) further. A: Suppose I own 3 bananas and 6 apples, and you own 5 bananas...
-
Consider Sunny who is committed to a life of crime. Sunny is risk averse, knows that he will enjoy consumption level x 1 if he does not get caught and consumption level of x 0 (very much below x 1 )...
-
A: Suppose you have a homothetic production technology and you face output price p and input prices ( w , r ) . (a) On a graph with labor on the horizontal and capital k on the vertical axis, draw an...
-
If you want to understand how the worldwide quality movement has benefited consumers, just look at automobiles. What used to be considered a luxury option is now just standard, said one quality...
-
Immediately following World War II, the quality of products produced by Japanese companies was not good enough to compete in the international marketplace. The only advantage Japanese companies had...
-
A professional baseball team set its sights on winning the World Series. The team owner wanted to win big and win fast. Consequently, the team sank all of its resources into trading for the best...
Study smarter with the SolutionInn App