MooingCat

2022 Tenth Anniversary

Mar 16th, 2022
1,315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.55 KB | None | 0 0
  1. import random
  2. from copy import copy
  3. import numpy as np
  4. from matplotlib import pyplot as plt
  5. import math
  6.  
  7. paper = 8755+370# +800+1000
  8. gold = 6
  9.  
  10. res = []
  11. res2 = []
  12. res3 = []
  13. for i in range(10000):
  14.     total = 0
  15.     for j in range(math.floor(paper/100)):
  16.         total += random.randint(1,6)
  17.    
  18.     total += gold*6
  19.     res.append(total)
  20.  
  21. for i in range(10000):
  22.     total = 0
  23.     for j in range(math.floor((paper+500)/100)):
  24.         total += random.randint(1,6)
  25.    
  26.     total += gold*6
  27.     res2.append(total)
  28.  
  29.  
  30. for i in range(10000):
  31.     total = 0
  32.     for j in range(math.floor((paper+1000)/100)):
  33.         total += random.randint(1,6)
  34.    
  35.     total += gold*6
  36.     res3.append(total)
  37.  
  38.  
  39. showplot = True
  40. if showplot:
  41.     label = "Distribution"
  42.     rmin = min(res)
  43.     rmax = max(res)+1
  44.     fig, ax = plt.subplots(3,1,figsize=(5,5))
  45.     fig.suptitle("Tenth Anniversary")
  46.     ax[0].hist(res, edgecolor='white', color="darkorange", bins=range(rmin, rmax, 1))
  47.     ax[0].axvline(x=352,linewidth=2,label="Required Tiles with Surprise Box",color="blue")
  48.     ax[0].axvline(x=416,linewidth=2,label="Required Tiles without Surprise Box",color="red")
  49.     ax[0].set_yticklabels([])
  50.     ax[0].set_title("Number of tiles with " +str(paper) + " Paper Money & " + str(gold) + " Golden Dice (6 tiles each)")
  51.     # ax[0].set_ylabel("Probability")
  52.     # ax[0].set_xlabel("Tiles")
  53.  
  54.  
  55.     label1 = "Distribution"
  56.     rmin1 = min(res2)
  57.     rmax1 = max(res2)+1
  58.  
  59.     ax[1].hist(res2, edgecolor='white', color="darkorange", bins=range(rmin1, rmax1, 1))
  60.     ax[1].axvline(x=352,linewidth=2,label="Required Tiles with Surprise Box",color="blue")
  61.     ax[1].axvline(x=416,linewidth=2,label="Required Tiles without Surprise Box",color="red")
  62.     ax[1].set_yticklabels([])
  63.     ax[1].set_title("Number of tiles with " +str(paper+500) + " Paper Money & " + str(gold) + " Golden Dice (6 tiles each)")
  64.     # ax[1].set_ylabel("Probability")
  65.     # ax[1].set_xlabel("Tiles")
  66.  
  67.     label2 = "Distribution"
  68.     rmin2 = min(res3)
  69.     rmax2 = max(res3)+1
  70.     ax[2].hist(res3, edgecolor='white', color="darkorange", bins=range(rmin2, rmax2, 1))
  71.     ax[2].axvline(x=352,linewidth=2,label="Required Tiles with Surprise Box",color="blue")
  72.     ax[2].axvline(x=416,linewidth=2,label="Required Tiles without Surprise Box",color="red")
  73.     ax[2].set_yticklabels([])
  74.     ax[2].set_title("Number of tiles with " +str(paper+1000) + " Paper Money & " + str(gold) + " Golden Dice (6 tiles each)")
  75.     # ax[2].set_ylabel("Probability")
  76.     # ax[2].set_xlabel("Tiles")
  77.     plt.legend()
  78.     plt.show()
Advertisement
Add Comment
Please, Sign In to add comment