#Grime's Dice Simulator #Variables to count how many times a particular color wins a 30-rolls game bluewins = 0 greenwins = 0 #y is how many 30-rolls games you want to play for y in range(0, 1000): #Variables to count how many times a particular color wins in a 30-rolls game bluetotal = 0 greentotal = 0 #x is how many rolls in a game for x in range(0, 30): #Blue die has five 3s and one 6 import random roll = random.randint(1,6) if roll > 5: blue = 6 else: blue = 3 #Green die has three 5s and three 2s import random roll = random.randint(1,6) if roll > 3: green = 5 else: green = 2 # import random # roll = random.randint(1,6) # if roll > 5: # purple = 1 # else: # purple = 4 if blue > green: bluetotal = bluetotal + 1 else: greentotal = greentotal + 1 if bluetotal > greentotal: bluewins = bluewins + 1 else: greenwins = greenwins + 1 print "Blue", bluewins print "Green", greenwins
Sunday, May 5, 2013
Grime's Dice simulator
Python program for Grime's Dice:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment