How to implement this? al Help hog.py -hog - Visual Studio Code def play(strategy0, strategyl, update, hog.py
Fantastic news! We've Found the answer you've been seeking!
Question:
How to implement this?
Transcribed Image Text:
al Help hog.py -hog - Visual Studio Code def play(strategy0, strategyl, update, hog.py X hog.py> play 135 136 137 138 139 140 141 142 143 144 score0=0, scorel=0, dice=six_sided, goal=GOAL): """Simulate a game and return the final scores of both players, with Player O's score first and Player 1's score second. E.g., play (always_roll_5, always_roll_5, sus_update) simulates a game in which both players always choose to roll 5 dice on every turn and the Sus Fuss rule is in effect. A strategy function, such as always_roll_5, takes the current player's score and their opponent's score and returns the number of dice the current player chooses to roll. An update function, such as sus_update or simple_update, takes the number of dice to roll, the current player's score, the opponent's score, and the dice function used to simulate rolling dice. It returns the updated score of the current player after they take their turn. strategy: The strategy for player0. strategyl: The strategy for player1. 145 146 147 148 149 150 151 152 153 154 155 156 update: 157 score0: 158 scorel: 159 dice: 160 goal: 161 162 163 # BEGIN PROBLEM 5 164 165 # END PROBLEM 5 166 return score0, scorel 167 The update function (used for both players). Starting score for Player 0 Starting score for Player 1 A function of zero arguments that simulates a dice roll. The game ends and someone wins when this score is reached. who = 0 # Who is about to take a turn, 0 (first) or 1 (second) PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS # UnboundLocalError: local variable 'player' referenced before assignment Run only this test case with "python3 ok -q 05 --suite 2 --case 1" Test summary 4 test cases passed before encountering first failed test case Backup... 100% complete Backup successful for user: baldo24@berkeley.edu URL: https://okpy.org/cal/cs6la/fa23/proj01/backups/BXRrpm OK is up to date o s277-18 [223] -/Desktop/cs61a/hog # 2022 CS61A Hog ... hog.py-hog-Visual S... I al Help hog.py -hog - Visual Studio Code def play(strategy0, strategyl, update, hog.py X hog.py> play 135 136 137 138 139 140 141 142 143 144 score0=0, scorel=0, dice=six_sided, goal=GOAL): """Simulate a game and return the final scores of both players, with Player O's score first and Player 1's score second. E.g., play (always_roll_5, always_roll_5, sus_update) simulates a game in which both players always choose to roll 5 dice on every turn and the Sus Fuss rule is in effect. A strategy function, such as always_roll_5, takes the current player's score and their opponent's score and returns the number of dice the current player chooses to roll. An update function, such as sus_update or simple_update, takes the number of dice to roll, the current player's score, the opponent's score, and the dice function used to simulate rolling dice. It returns the updated score of the current player after they take their turn. strategy: The strategy for player0. strategyl: The strategy for player1. 145 146 147 148 149 150 151 152 153 154 155 156 update: 157 score0: 158 scorel: 159 dice: 160 goal: 161 162 163 # BEGIN PROBLEM 5 164 165 # END PROBLEM 5 166 return score0, scorel 167 The update function (used for both players). Starting score for Player 0 Starting score for Player 1 A function of zero arguments that simulates a dice roll. The game ends and someone wins when this score is reached. who = 0 # Who is about to take a turn, 0 (first) or 1 (second) PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS # UnboundLocalError: local variable 'player' referenced before assignment Run only this test case with "python3 ok -q 05 --suite 2 --case 1" Test summary 4 test cases passed before encountering first failed test case Backup... 100% complete Backup successful for user: baldo24@berkeley.edu URL: https://okpy.org/cal/cs6la/fa23/proj01/backups/BXRrpm OK is up to date o s277-18 [223] -/Desktop/cs61a/hog # 2022 CS61A Hog ... hog.py-hog-Visual S... I
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Rearrange the following lines of code to read two integers until two different input values are entered. How to use this tool Unused valid = True second = int (input()) while not valid : valid print...
-
The light bulbs produced by Edison Lighting Corporation last an average of 300 h. The life of the light bulbs is believed to follow a normal distribution with a standard deviation of 10. A customer...
-
Wharton, Inc. pays income taxes on capital gains at a rate of 30 percent. At December 31, 2015, the company owns marketable securities that cost $180,000 but have a current market value of $520,000....
-
Think about how you might reorient yourself to your own job. Are the principles of job crafting described above relevant to your work? Why or why not? Consider for a moment a midlevel manager at a...
-
Which types of economic damages are related to digital crimes?
-
Carmin Kovach is single and has two children from her previous marriage. Anika, 9, lives with Carmin. Julius, 11, lives with his father, Ray. Carmin pays alimony of $400 per month to Ray. The...
-
Consider again the market studied in Question 2, The demand curve is given by P = 100 Q and the marginal cost curve is given by MC = 10. This time we are going to assume that firms must invest funds...
-
if a 1 2 5 0 N force acts on a 7 0 kg box in a Northerly direction and a 8 3 0 N force acts on the box at an angle of 1 2 0 what is the resultant force on the box? b . What is the net acceleration of...
-
find out what the capital structure of Apple Inc. looks like, and use this information and estimate Apple's weighted average cost of capital (WACC). Second, compare the capital structure of Apple...
-
DWagon Distributors sells drinks on deals. Three Juices and six water for $42, while the cost of four juices and four water sells for $36. Use x to represent the juices and y to represent the water....
-
Increasing the strain rate of a tensile test will normally result in which one of the following for a metal such as aluminum? its measured yield strength will slightly decrease it will be less likely...
-
It is important to remember that e-mail? is different than regular business correspondence is private and discrete within a company is legally available at any time for your employer to review
-
The British Guiana 1c magenta stamp is considered the world's most famous stamp. It was issued in 1856, and only one of these stamps is known to exist. The sale of this stamp has broken the record...
-
A bank vault has three locks with a different key for each lock. Each key is owned by a different person. To open the door, at least two people must insert their keys into the assigned locks. The...
-
Currently, there are five concepts of food stands, including: hot dogs, soft pretzels, turkey legs, sandwich wraps, and funnel cakes. This approach will double the existing number of food stands...
-
What is the sensitivity of the test for light-smoking students (students who smoke ¤ 14 cigarettes per week)? Suppose the self-reports are completely accurate and are representative of the...
-
In some studies only values at least 1.5 times as high as the upper limit of normal are identified as abnormal. What percentage of values would fall in this range? Blood Chemistry In pharmacologic...
-
Test whether the 5-year survival rate for breast cancer is significantly different between African American and Caucasian women who are younger than 50 years of age and have localized disease....
-
Show that the quantum-mechanical partition function of a system of \(N\) interacting particles approaches the classical form \[Q_{N}(V, T)=\frac{1}{N ! h^{3 N}} \int e^{-\beta E(\boldsymbol{q},...
-
Show that the entropy of an ideal gas in thermal equilibrium is given by the formula \[ S=k \sum_{\varepsilon}\left[\left\langle n_{\varepsilon}+1ightangle \ln \left\langle...
-
Show that the root-mean-square deviation in the molecular energy \(\varepsilon\), in a system obeying Maxwell-Boltzmann distribution, is \(\sqrt{ }(2 / 3)\) times the mean molecular energy...
Study smarter with the SolutionInn App