Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. import random
  2. import time
  3. import matplotlib.pyplot as plt
  4.  
  5. starToSuccess = {0: 0.95, 1: 0.9, 2: 0.85, 3: 0.85, 4: 0.8, 5: 0.75, 6: 0.7,
  6. 7: 0.65, 8: 0.6, 9: 0.55, 10: 0.45, 11: 0.35, 12: 0.30, 13: 0.30,
  7. 14: 0.30, 15: 0.30, 16: 0.30, 17: 0.30, 18: 0.30, 19: 0.30, 20: 0.30, 21: 30,
  8. 22: 0.03, 23: 0.02, 24: 0.01}
  9.  
  10. starToMaint = {0: 0.05, 1: 0.1, 2: 0.15, 3: 0.15, 4: 0.20, 5: 0.25, 6: 0,
  11. 7: 0, 8: 0, 9: 0, 10: 0.55, 11: 0, 12: 0, 13: 0,
  12. 14: 0, 15: 0.679, 16: 0, 17: 0, 18: 0, 19: 0, 20: 63, 21: 0,
  13. 22: 0, 23: 0, 24: 0}
  14.  
  15. starToDecrease = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0.3,
  16. 7: 0.35, 8: 0.40, 9: 0.45, 10: 0, 11: 0.65, 12: 0.6931, 13: 0.686,
  17. 14: 0.686, 15: 0, 16: 0.679, 17: 0.679, 18: 0.672, 19: 0.672, 20: 0, 21: 0.63,
  18. 22: 0.776, 23: 0.686, 24: 0.594}
  19.  
  20. starToDestroy = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0,
  21. 7: 0, 8: 0, 9: 0, 10: 0.55, 11: 0, 12: 0.007, 13: 0.014,
  22. 14: 0.014, 15: 0.021, 16: 0.021, 17: 0.021, 18: 0.028, 19: 0.028, 20: 0.07, 21: 0.07,
  23. 22: 0.194, 23: 0.294, 24: 0.396}
  24.  
  25. boomDistribution = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0,
  26. 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0,
  27. 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0, 20: 0, 21: 0,
  28. 22: 0, 23: 0, 24: 0}
  29.  
  30. moneyVals = []
  31.  
  32. multipliers = {'k': 1e3, 'm': 1e6, 'b': 1e9}
  33.  
  34. # pattern = r'([0-9.]+)([bkm])'
  35. # for number, suffix in re.findall(pattern, USER-PASSED-VAR):
  36. # number = float(number)
  37. # print number * multipliers[suffix]
  38.  
  39.  
  40. totalDestroys = 0
  41. totalSteps = 0
  42. sTime = time.time()
  43. for i in range (0, 1000):
  44. currentMoney = 0
  45. currentStars = 0
  46. while not currentStars == 22:
  47. starSuccess = starToSuccess.get(currentStars)
  48. starMaint = starToMaint.get(currentStars)
  49. starDecrease = starToDecrease.get(currentStars)
  50. starDestroy = starToDestroy.get(currentStars)
  51. output = random.random()
  52.  
  53. # Add money values based on a lv160 equip using KMS formulas
  54. if 0 <= currentStars <= 9:
  55. currentMoney += (1000 + (160 ** 3) * (currentStars + 1)/25)
  56. elif 10 <= currentStars <= 14:
  57. currentMoney += (1000 + (160 ** 3) * ((currentStars+1) ** 2.7) / 400)
  58. else:
  59. currentMoney += (1000 + (160 ** 3) * ((currentStars+1) ** 2.7) / 200)
  60.  
  61. if 0 < output <= starSuccess:
  62. currentStars +=1
  63. elif starSuccess < output < starMaint:
  64. pass
  65. elif starSuccess < output < starDecrease:
  66. currentStars -= 1
  67. elif starSuccess + starMaint + starDecrease <= output:
  68. boomDistribution[currentStars] += 1
  69. currentStars = 0
  70. totalDestroys += 1
  71. moneyVals.append(currentMoney)
  72.  
  73. moneyToCompare = 10000000000
  74. total = 0
  75. for num in moneyVals:
  76. if num <= moneyToCompare:
  77. total+=1
  78.  
  79. odds = total/len(moneyVals)
  80.  
  81. print("Success!\nMoney requied: " + str(currentMoney) + "\nTotal destroys: " + str(totalDestroys) + "\nTotal Steps: " + str(totalSteps))
  82. print("Total run time: " + str(time.time() - sTime))
  83. print("The odds of you getting 22 stars with your budget is: " + str(odds))
  84. # plt.bar(range(len(boomDistribution)), list(boomDistribution.values()), align='center')
  85. # plt.xticks(range(len(boomDistribution)), list(boomDistribution.keys()))
  86. # plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement