Advertisement
Guest User

Untitled

a guest
Mar 6th, 2019
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import random
  2.  
  3. lands = 4*['B'] + 3*['U'] + 3*['G'] + 3*['W'] + 3*['UG'] + 1*['UW'] + 1*['WB']
  4. num_simulations = 500000
  5.  
  6. lands_drawn = [3, 4, 5, 6]
  7. for num_lands in lands_drawn:
  8.     counts = [0] * 5
  9.     for _ in range(num_simulations):
  10.         lands_drawn = random.sample(lands, num_lands)
  11.         colors = []
  12.         for card in lands_drawn:
  13.             colors += list(card)
  14.         colors = set(colors)
  15.         counts[len(colors)] += 1
  16.     print('{}: {}'.format(num_lands, [count / num_simulations for count in counts]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement