Advertisement
Guest User

Test going off with Maze's End in DGM draft

a guest
Mar 25th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. #!/usr/bin/python
  2. from fractions import Fraction
  3. import random
  4.  
  5.  
  6. def trial():
  7.     havegate = [False]*10
  8.  
  9.     # The other DGM boosters (we're assuming you get Maze's end P1P1)
  10.     for i in xrange(7):
  11.         if random.randrange(121) >= 6:  # Don't get a shock or another Maze
  12.             havegate[random.randrange(10)] = True
  13.  
  14.     # The GTC and RTR boosters
  15.     for setnum in (0, 1):
  16.         commons = [None]*96 + range(setnum*5, setnum*5 + 5)
  17.         for i in xrange(8):
  18.             random.shuffle(commons)
  19.             if random.randrange(56) >= 15:  # No foil card
  20.                 for c in commons[:10]:
  21.                     if c is not None:
  22.                         havegate[c] = True
  23.             else:
  24.                 for c in commons[:9]:
  25.                     if c is not None:
  26.                         havegate[c] = True
  27.                 if random.randrange(15) < 10:  # Foil card is common
  28.                     # rerandomise, don't just take commons[9]
  29.                     # as we can have repeats with foils
  30.                     c = random.choice(commons)
  31.                     if c is not None:
  32.                         havegate[c] = True
  33.     return havegate
  34.  
  35.  
  36. def manytrials(n=1000):
  37.     cnt = 0
  38.     for i in xrange(n):
  39.         if all(trial()):
  40.             cnt += 1
  41.     return Fraction(cnt, n)
  42.  
  43. if __name__ == "__main__":
  44.     result = manytrials(1000000)
  45.     print result
  46.     print float(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement