Procedure Find the RockPaperScissors package in the labs source folder. Create a new class RPS there,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Procedure Find the RockPaperScissors package in the labs source folder. Create a new class RPS there, and you are ready to begin your development. It is suggested that you develop code in small steps, so that you can proceed from confidence to confidence, and not have a big pile of untested code to debug at the end. To help motivate this approach, the TAs will not help you unless you have shown progress based on these steps. Ask for help as soon as you need it, but please follow the steps below so that you can gain confidence. The steps you might consider are as follows: 1. What inputs does your program need? First, get your program to accept those inputs and print them out so you can see they are set properly. This means that you should type in the code to prompt the user for the input(s), print out the values of those inputs, and that's all for now. Run your program at this point and make sure it is behaving as you want. What inputs do you need? There's no reason to ask for more than is necessary. At a minimum, you have to know how many rounds of RPS to play before printing the resulting statistics 2. Next, create a loop that simply iterates the desired number of times. Again, run your program. You may want to print something out in your loop so you can verify that the loop works correctly. 3. You next can make the concept of the random player real. This means declaring a variable name of a suitable type to represent this concept, establishing the variable's initial value. What is the concept of the player? There are many details about the player that appear unnecessary: the player's name, address, cell phone number. On the other hand, if we are going to play RPS, we need to know what move the player has made. This is the important concept. How do we represent the choice of rock, paper, or scissors? This is left up to you, so try for something simple. It may help to recall how Paul Revere was poetically told of how the British were coming: one if by land, two if by sea. In otherwords, an int encoded the manner of invasion. If there were only two choices, why didn't Paul use a boolean ? Sadly, Boole was not yet born 4. In your loop, you should modify this variable's value to reflect the associated player choosing randomly among rock, paper, and scissors each iteration. You've seen how to use the random number generator to pick between two outcomes. Now you must pick between three. 5. Run your program and verify that the player is choosing randomly. 6. OK, now for the other player. This player must cycle among rock, paper, and scissors. Let's make this player real by declaring a variable name of a suitable type and establishing its initial value. In the interest of consistency and simplicity, you should use the same encoding for this player in terms of what value means rock, what value means paper, and what value means scissors. 7. In your loop, arrange for this player to choose its next move based on its previous move. If the move used to be rock, it's now paper. If the move used to be paper, it's now scissors. If the move was scissors, it's now rock. 8. Run your program again and make sure the cycling player is behaving properly. To verify the cycling player's behavior, you will probably want to print out the values representing that player's move each iteration. It won't take many iterations to see if this is working or not: 10 should do. 9. Each player has made a move; now let's see who won. First, pick a name, type, and initial value for the number of wins a player has. Do the same for the other player. Why do we need a variable to keep track of each player's wins? Why not keep track of only one player's wins and assume the other player won the other rounds? 10. In the loop, determine who won based on the current value of each player's move. Use the rules of RPS to adjudicate the winner, and credit the win count properly. 11. After the loop completes, report the fraction of wins awarded to each of the two players. 12. Test your code by trying it with just one iteration, two iterations, and three iterations. Make sure it's working before you set it loose. 13. Run your code several times, each on 1000 iterations. 14. Based on what you see, did one player tend to win more often than the other? Criteria Is the computer player truly random? Is *anything* truly random? You know what I mean... Does the "human" player cycle? Does the game follow RPS rules to determine winners? Does it count win/loss statistics? Ratings 0 pts Correct 0 pts Correct 0 pts Correct 0 pts Correct 0 pts Incorrect Pts O pts 0 pts Incorrect 0 pts 0 pts Incorrect 0 pts 0 pts Incorrect 0 pts Procedure Find the RockPaperScissors package in the labs source folder. Create a new class RPS there, and you are ready to begin your development. It is suggested that you develop code in small steps, so that you can proceed from confidence to confidence, and not have a big pile of untested code to debug at the end. To help motivate this approach, the TAs will not help you unless you have shown progress based on these steps. Ask for help as soon as you need it, but please follow the steps below so that you can gain confidence. The steps you might consider are as follows: 1. What inputs does your program need? First, get your program to accept those inputs and print them out so you can see they are set properly. This means that you should type in the code to prompt the user for the input(s), print out the values of those inputs, and that's all for now. Run your program at this point and make sure it is behaving as you want. What inputs do you need? There's no reason to ask for more than is necessary. At a minimum, you have to know how many rounds of RPS to play before printing the resulting statistics 2. Next, create a loop that simply iterates the desired number of times. Again, run your program. You may want to print something out in your loop so you can verify that the loop works correctly. 3. You next can make the concept of the random player real. This means declaring a variable name of a suitable type to represent this concept, establishing the variable's initial value. What is the concept of the player? There are many details about the player that appear unnecessary: the player's name, address, cell phone number. On the other hand, if we are going to play RPS, we need to know what move the player has made. This is the important concept. How do we represent the choice of rock, paper, or scissors? This is left up to you, so try for something simple. It may help to recall how Paul Revere was poetically told of how the British were coming: one if by land, two if by sea. In otherwords, an int encoded the manner of invasion. If there were only two choices, why didn't Paul use a boolean ? Sadly, Boole was not yet born 4. In your loop, you should modify this variable's value to reflect the associated player choosing randomly among rock, paper, and scissors each iteration. You've seen how to use the random number generator to pick between two outcomes. Now you must pick between three. 5. Run your program and verify that the player is choosing randomly. 6. OK, now for the other player. This player must cycle among rock, paper, and scissors. Let's make this player real by declaring a variable name of a suitable type and establishing its initial value. In the interest of consistency and simplicity, you should use the same encoding for this player in terms of what value means rock, what value means paper, and what value means scissors. 7. In your loop, arrange for this player to choose its next move based on its previous move. If the move used to be rock, it's now paper. If the move used to be paper, it's now scissors. If the move was scissors, it's now rock. 8. Run your program again and make sure the cycling player is behaving properly. To verify the cycling player's behavior, you will probably want to print out the values representing that player's move each iteration. It won't take many iterations to see if this is working or not: 10 should do. 9. Each player has made a move; now let's see who won. First, pick a name, type, and initial value for the number of wins a player has. Do the same for the other player. Why do we need a variable to keep track of each player's wins? Why not keep track of only one player's wins and assume the other player won the other rounds? 10. In the loop, determine who won based on the current value of each player's move. Use the rules of RPS to adjudicate the winner, and credit the win count properly. 11. After the loop completes, report the fraction of wins awarded to each of the two players. 12. Test your code by trying it with just one iteration, two iterations, and three iterations. Make sure it's working before you set it loose. 13. Run your code several times, each on 1000 iterations. 14. Based on what you see, did one player tend to win more often than the other? Procedure Find the RockPaperScissors package in the labs source folder. Create a new class RPS there, and you are ready to begin your development. It is suggested that you develop code in small steps, so that you can proceed from confidence to confidence, and not have a big pile of untested code to debug at the end. To help motivate this approach, the TAs will not help you unless you have shown progress based on these steps. Ask for help as soon as you need it, but please follow the steps below so that you can gain confidence. The steps you might consider are as follows: 1. What inputs does your program need? First, get your program to accept those inputs and print them out so you can see they are set properly. This means that you should type in the code to prompt the user for the input(s), print out the values of those inputs, and that's all for now. Run your program at this point and make sure it is behaving as you want. What inputs do you need? There's no reason to ask for more than is necessary. At a minimum, you have to know how many rounds of RPS to play before printing the resulting statistics 2. Next, create a loop that simply iterates the desired number of times. Again, run your program. You may want to print something out in your loop so you can verify that the loop works correctly. 3. You next can make the concept of the random player real. This means declaring a variable name of a suitable type to represent this concept, establishing the variable's initial value. What is the concept of the player? There are many details about the player that appear unnecessary: the player's name, address, cell phone number. On the other hand, if we are going to play RPS, we need to know what move the player has made. This is the important concept. How do we represent the choice of rock, paper, or scissors? This is left up to you, so try for something simple. It may help to recall how Paul Revere was poetically told of how the British were coming: one if by land, two if by sea. In otherwords, an int encoded the manner of invasion. If there were only two choices, why didn't Paul use a boolean ? Sadly, Boole was not yet born 4. In your loop, you should modify this variable's value to reflect the associated player choosing randomly among rock, paper, and scissors each iteration. You've seen how to use the random number generator to pick between two outcomes. Now you must pick between three. 5. Run your program and verify that the player is choosing randomly. 6. OK, now for the other player. This player must cycle among rock, paper, and scissors. Let's make this player real by declaring a variable name of a suitable type and establishing its initial value. In the interest of consistency and simplicity, you should use the same encoding for this player in terms of what value means rock, what value means paper, and what value means scissors. 7. In your loop, arrange for this player to choose its next move based on its previous move. If the move used to be rock, it's now paper. If the move used to be paper, it's now scissors. If the move was scissors, it's now rock. 8. Run your program again and make sure the cycling player is behaving properly. To verify the cycling player's behavior, you will probably want to print out the values representing that player's move each iteration. It won't take many iterations to see if this is working or not: 10 should do. 9. Each player has made a move; now let's see who won. First, pick a name, type, and initial value for the number of wins a player has. Do the same for the other player. Why do we need a variable to keep track of each player's wins? Why not keep track of only one player's wins and assume the other player won the other rounds? 10. In the loop, determine who won based on the current value of each player's move. Use the rules of RPS to adjudicate the winner, and credit the win count properly. 11. After the loop completes, report the fraction of wins awarded to each of the two players. 12. Test your code by trying it with just one iteration, two iterations, and three iterations. Make sure it's working before you set it loose. 13. Run your code several times, each on 1000 iterations. 14. Based on what you see, did one player tend to win more often than the other? Criteria Is the computer player truly random? Is *anything* truly random? You know what I mean... Does the "human" player cycle? Does the game follow RPS rules to determine winners? Does it count win/loss statistics? Ratings 0 pts Correct 0 pts Correct 0 pts Correct 0 pts Correct 0 pts Incorrect Pts O pts 0 pts Incorrect 0 pts 0 pts Incorrect 0 pts 0 pts Incorrect 0 pts Criteria Is the computer player truly random? Is *anything* truly random? You know what I mean... Does the "human" player cycle? Does the game follow RPS rules to determine winners? Does it count win/loss statistics? Ratings 0 pts Correct 0 pts Correct 0 pts Correct 0 pts Correct 0 pts Incorrect Pts O pts 0 pts Incorrect 0 pts 0 pts Incorrect 0 pts 0 pts Incorrect 0 pts
Expert Answer:
Related Book For
Managerial Communication Strategies and Applications
ISBN: 978-1483358550
6th edition
Authors: Geraldine E. Hynes
Posted Date:
Students also viewed these programming questions
-
Variance Analysis: Case Study: ACC 6 4 2 - strategic cost management Variance Analysis in XYZ Manufacturing Company Background: XYZ Manufacturing Company produces electronic devices. In the last...
-
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...
-
Please check my code for errors agaisnt the assignment which is long. The parts Dog and rescueAnimals files cannot be changed nor the original given code in the Driver file only can modify where it...
-
The supplies account had a beginning balance of $1,523. Supplies purchased during the period totaled $4,928. At the end of the period before adjustment, $382 of supplies were hand. Prepare the...
-
Show that (1.85) satisfies all four determinant axioms, and hence is the correct formula for a determinant.
-
IMSE Farm supplies apples directly from their two farms (A and B) to the three grocery stores (1, 2, and 3), where the transportation is operated by a logistics service provider. The two farms are...
-
It seems that leaders and effective followers may be more alike than leaders and managers. Is that so?
-
Ethics; Predetermined Overhead Rate and Capacity Pat Miranda, the new controller of Vault Hard Drives, Inc., has just returned from a seminar on the choice of the activity level in the predetermined...
-
Consider the different types of evidence we have covered so far (presumptive testing, fiber evidence, impressions and toolmarks, firearms, bloodstain patterns, behavioral evidence, etc.). How would...
-
Find the simple interest for each of the following. Round to the nearest cent. 1. $27,850 at 7.75% for 100 days 2. $7800 at 9.25% for 4 months 3. A loan of $5800 at 9% made on May 22 and due July 5...
-
Stock A has an expected cost of equity of 15%. Assuming a risk-free rate of 4% and expected market return of 8%, what is a close estimate of stock A's beta?
-
What role does organizational resilience play in a company's ability to adapt to external shocks and disruptions? Discuss the key factors that contribute to building and sustaining resilience ?
-
Beverly Company has determined a standard variable overhead rate of $3.90 per direct labor hour and expects to incur 0.50 labor hours per unit produced. Last month, Beverly incurred 1,650 actual...
-
On January 8, the end of the first weekly pay period of the year, Regis Company's employees earned $25,760 of office salaries and $60,840 of sales salaries. Withholdings from the employees' salaries...
-
Let be an alphabet. The symmetric difference of two languages A, B C * is defined as AAB = (ANB) U (ANB). (a) Prove that if A C* is a context-free language and BC * is a finite language, the the...
-
The pressure relief valve in your hot water heater (sizedesignation: Type G) has an orifice area of 0.503 in2 . It is setto open and relieve the pressure in the heater if it 23 reaches 150psi. The...
-
1. Consider the following architecture: Site 3 52 Computer Network Site 4 Site 1 Database a. Identity the above architecture and list two advantages and two disadvantages of the above approach. b....
-
If you want to solve a minimization problem by applying the geometric method to the dual problem, how many variables and problem constraints must be in the original problem?
-
Jesse Matthews sat in his office with a puzzled look on his face. He had received a Word file from Ellen Linares, a report that was to be presented to upper management in the morning. Ellens e-mail...
-
Consider the conflict that developed in the textile mill over raises. Write a note that would clarify the procedure for new employees.
-
What are some advantages of written over oral communication?
-
Sometimes total spending is excessive, and _________ occurs.
-
Sometimes total spending is insufficient, and _________ occurs.
-
In the case of market _________, appropriate government policies could improve on market outcomes.
Study smarter with the SolutionInn App