Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to implement this? al Help hog.py -hog - Visual Studio Code def play(strategy0, strategyl, update, hog.py X hog.py> play 135 136 137 138 139

How to  implement this?

image

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Biostatistics

Authors: Bernard Rosner

8th Edition

130526892X, 978-1305465510, 1305465512, 978-1305268920

More Books

Students also viewed these Programming questions

Question

What is your greatest strength?

Answered: 1 week ago