Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- import matplotlib.pyplot as plt
- starToSuccess = {0: 0.95, 1: 0.9, 2: 0.85, 3: 0.85, 4: 0.8, 5: 0.75, 6: 0.7,
- 7: 0.65, 8: 0.6, 9: 0.55, 10: 0.45, 11: 0.35, 12: 0.30, 13: 0.30,
- 14: 0.30, 15: 0.30, 16: 0.30, 17: 0.30, 18: 0.30, 19: 0.30, 20: 0.30, 21: 30,
- 22: 0.03, 23: 0.02, 24: 0.01}
- starToMaint = {0: 0.05, 1: 0.1, 2: 0.15, 3: 0.15, 4: 0.20, 5: 0.25, 6: 0,
- 7: 0, 8: 0, 9: 0, 10: 0.55, 11: 0, 12: 0, 13: 0,
- 14: 0, 15: 0.679, 16: 0, 17: 0, 18: 0, 19: 0, 20: 63, 21: 0,
- 22: 0, 23: 0, 24: 0}
- starToDecrease = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0.3,
- 7: 0.35, 8: 0.40, 9: 0.45, 10: 0, 11: 0.65, 12: 0.6931, 13: 0.686,
- 14: 0.686, 15: 0, 16: 0.679, 17: 0.679, 18: 0.672, 19: 0.672, 20: 0, 21: 0.63,
- 22: 0.776, 23: 0.686, 24: 0.594}
- starToDestroy = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0,
- 7: 0, 8: 0, 9: 0, 10: 0.55, 11: 0, 12: 0.007, 13: 0.014,
- 14: 0.014, 15: 0.021, 16: 0.021, 17: 0.021, 18: 0.028, 19: 0.028, 20: 0.07, 21: 0.07,
- 22: 0.194, 23: 0.294, 24: 0.396}
- boomDistribution = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0,
- 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0,
- 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0, 20: 0, 21: 0,
- 22: 0, 23: 0, 24: 0}
- moneyVals = []
- multipliers = {'k': 1e3, 'm': 1e6, 'b': 1e9}
- # pattern = r'([0-9.]+)([bkm])'
- # for number, suffix in re.findall(pattern, USER-PASSED-VAR):
- # number = float(number)
- # print number * multipliers[suffix]
- totalDestroys = 0
- totalSteps = 0
- sTime = time.time()
- for i in range (0, 1000):
- currentMoney = 0
- currentStars = 0
- while not currentStars == 22:
- starSuccess = starToSuccess.get(currentStars)
- starMaint = starToMaint.get(currentStars)
- starDecrease = starToDecrease.get(currentStars)
- starDestroy = starToDestroy.get(currentStars)
- output = random.random()
- # Add money values based on a lv160 equip using KMS formulas
- if 0 <= currentStars <= 9:
- currentMoney += (1000 + (160 ** 3) * (currentStars + 1)/25)
- elif 10 <= currentStars <= 14:
- currentMoney += (1000 + (160 ** 3) * ((currentStars+1) ** 2.7) / 400)
- else:
- currentMoney += (1000 + (160 ** 3) * ((currentStars+1) ** 2.7) / 200)
- if 0 < output <= starSuccess:
- currentStars +=1
- elif starSuccess < output < starMaint:
- pass
- elif starSuccess < output < starDecrease:
- currentStars -= 1
- elif starSuccess + starMaint + starDecrease <= output:
- boomDistribution[currentStars] += 1
- currentStars = 0
- totalDestroys += 1
- moneyVals.append(currentMoney)
- moneyToCompare = 10000000000
- total = 0
- for num in moneyVals:
- if num <= moneyToCompare:
- total+=1
- odds = total/len(moneyVals)
- print("Success!\nMoney requied: " + str(currentMoney) + "\nTotal destroys: " + str(totalDestroys) + "\nTotal Steps: " + str(totalSteps))
- print("Total run time: " + str(time.time() - sTime))
- print("The odds of you getting 22 stars with your budget is: " + str(odds))
- # plt.bar(range(len(boomDistribution)), list(boomDistribution.values()), align='center')
- # plt.xticks(range(len(boomDistribution)), list(boomDistribution.keys()))
- # plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement