Advertisement
Guest User

Untitled

a guest
Sep 4th, 2019
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. import numpy as np
  2.  
  3.  
  4. def lmao(die_vals):
  5. chances_either = []
  6. for first_roll in die_vals:
  7. for second_roll in die_vals:
  8. chances_either.append(max(first_roll, second_roll))
  9. print("average for either:", np.mean(chances_either))
  10.  
  11. chances_new = []
  12. for first_roll in die_vals:
  13. for second_roll in die_vals:
  14. if first_roll < np.mean(die_vals):
  15. chances_new.append(second_roll)
  16. else:
  17. chances_new.append(first_roll)
  18. print("average for new:", np.mean(chances_new))
  19.  
  20. print("Ratio:", np.mean(chances_either) / np.mean(chances_new))
  21.  
  22.  
  23. def rofl(die):
  24. print("Dice:", die)
  25. chances_either = []
  26. for first_roll in range(1,die+1):
  27. for second_roll in range(1,die+1):
  28. chances_either.append(max(first_roll, second_roll))
  29. print("average for either:", np.mean(chances_either))
  30.  
  31. chances_new = []
  32. for first_roll in range(1,die+1):
  33. for second_roll in range(1,die+1):
  34. if first_roll < (die + 1) / 2:
  35. chances_new.append(second_roll)
  36. else:
  37. chances_new.append(first_roll)
  38. print("average for new:", np.mean(chances_new))
  39.  
  40. print("Ratio:", np.mean(chances_either) / np.mean(chances_new))
  41.  
  42.  
  43. rofl(4)
  44. rofl(6)
  45. rofl(8)
  46. rofl(10)
  47. rofl(12)
  48. rofl(20)
  49.  
  50. #test values for 2d6
  51. lmao([2,3,4,5,6,7,
  52. 3,4,5,6,7,8,
  53. 4,5,6,7,8,9,
  54. 5,6,7,8,9,10,
  55. 6,7,8,9,10,11,
  56. 7,8,9,10,11,12])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement