Question: the last question(problem 5 & problem6) def play(strategy IDLE File Edit Format Run Options Window Help hog.py-/Users/ryo/De CS 61A Presents The Game of Hog. from
IDLE File Edit Format Run Options Window Help hog.py-/Users/ryo/De CS 61A Presents The Game of Hog." from dice import six sided, four sided, make.test dice from ucb import main, trace, interact COAL-SCORE-100 # The goal of Hog is to score 100 points. Phase 1: Simulator # def roll dice(num rolls, dice-six_sided): Simulate rolling the DICE exactly the outcomes unless any of the outcomes is 1. In that case, return 1 nun rolls: The number of dice rolts that wilt be made dices A function that simulates a single dice roll out come # These assert statements ensure that num-rolls is o positive integer assert type assert numrolls, Must rolt at least once. # BEGIN PROBLEM I assert type(num.rolls)int, nun rolls must be on integer assert num rolls , Must roll at least once i, sum, pigout , , Folse while i nun rolls nun rolls)int,num.rolls must be on integer k - diceO pigout True else: END PROBLEM ! def freebacon(score): Reture the points scored fron rolling dice Free Bacon) ssert score
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
