This function that I have written thus:
def simulate_turn(num_rolls, score, opponent_score):
"""This function takes in two scores and a number of die rolls and returns
what the two scores would be if num_rolls many dice were rolled. This takes
into account the swine swap, free bacon, and hog-wild."""
x = score
y = opponent_score
x += take_turn(num_rolls,opponent_score,select_dice(score,opponent_score))
if ifwillswap(x,y):
swap(x,y)
return x,y
When run in the interactive python shell (the function comes from a .py file), it is returning an int object instead of a tuple! What am I doing wrong? I am trying to have it turn a pair of values, not a single int object.
take_turnand other undefined things withlambda *a: 1. It returns a tuple. (There's no way this function shown is returning anything other than a tuple. Thatreturnstatement returns a tuple.)xor the value ofy?swapworks. (Are you taking CS61A at UCB?)