Guest User

Untitled

a guest
Dec 14th, 2018
269
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. import scipy.stats as sps
  3.  
  4. bois_in_hand = 1
  5. on_play = False
  6. p_outcomes = np.zeros(5)
  7.  
  8. for bois_after_drawing in range(bois_in_hand, 5):
  9.     p_bois_after_drawing = sps.hypergeom.pmf(bois_after_drawing - bois_in_hand, 52 + on_play, 4 - bois_in_hand, 3)
  10.     p_bois_after_discarding = np.array([sps.hypergeom.pmf(i, 9 - on_play, bois_after_drawing, 6 - on_play) for i in range(5)])
  11.     p_outcomes += p_bois_after_discarding * p_bois_after_drawing
  12.  
  13. if on_play:
  14.     print('on play')
  15. else:
  16.     print('on draw')
  17. for p in p_outcomes[:-1]:
  18.     print('{0:.6f}'.format(p), end=', ')
  19. print('{0:.6f}'.format(p_outcomes[-1]))
  20. print('probability of casting at least 1 Hollow One: {}'.format(1 - p_outcomes[0]))
  21. print('expected Hollow Ones: {}'.format(np.sum([n*p_n for n, p_n in zip(range(5), p_outcomes)])))
RAW Paste Data