Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from fractions import Fraction
- import random
- def trial():
- havegate = [False]*10
- # The other DGM boosters (we're assuming you get Maze's end P1P1)
- for i in xrange(7):
- if random.randrange(121) >= 6: # Don't get a shock or another Maze
- havegate[random.randrange(10)] = True
- # The GTC and RTR boosters
- for setnum in (0, 1):
- commons = [None]*96 + range(setnum*5, setnum*5 + 5)
- for i in xrange(8):
- random.shuffle(commons)
- if random.randrange(56) >= 15: # No foil card
- for c in commons[:10]:
- if c is not None:
- havegate[c] = True
- else:
- for c in commons[:9]:
- if c is not None:
- havegate[c] = True
- if random.randrange(15) < 10: # Foil card is common
- # rerandomise, don't just take commons[9]
- # as we can have repeats with foils
- c = random.choice(commons)
- if c is not None:
- havegate[c] = True
- return havegate
- def manytrials(n=1000):
- cnt = 0
- for i in xrange(n):
- if all(trial()):
- cnt += 1
- return Fraction(cnt, n)
- if __name__ == "__main__":
- result = manytrials(1000000)
- print result
- print float(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement