Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.78 KB | None | 0 0
  1. # Calculating efficiency decision choosing with different skill methods
  2. import random
  3. import array
  4. import sys
  5.  
  6. xpHr = array.array('i',(0 for i in range(0,5)))
  7. gpHr = array.array('i',(0 for i in range(0,5)))
  8. totalHours = array.array('f',(sys.maxsize for i in range(0,5)))
  9. methodsSize = 5
  10.  
  11. profitHr = 2000000
  12. xpHr[0] = 280000
  13. gpHr[0] = -1425000
  14. xpHr[1] = 90000
  15. gpHr[1] = 800000
  16.  
  17. goalXp = 10000000
  18.  
  19. bestMoneyHr = max(max(gpHr),profitHr)
  20. print("######################################")
  21. for i in range(methodsSize):
  22.     if (xpHr[i] != 0):
  23.         hours = 0
  24.         print("method number",i+1)
  25.         hours = goalXp/xpHr[i]
  26.         totalProfit = gpHr[i] * hours
  27.         if (gpHr[i] < 0):
  28.             # adds extra hours for gathering gold for the skill
  29.             extraHours = abs(gpHr[i])*hours/profitHr
  30.             print ("extra hours gathering gold:",round(extraHours,2),"hours")
  31.             print ("hours skilling: ",round(hours,2),"hours")
  32.             hours += extraHours
  33.             print("gold spent on the skill:",round(totalProfit,2),"gp")
  34.             totalProfit = 0
  35.         else:
  36.             print("profit from the skill:",round(totalProfit,2),"gp")
  37.         print("total hours:",round(hours,2),"hours")
  38.         totalHours[i] = hours
  39.         print("")
  40.  
  41. fastestMethod = min(totalHours)
  42.  
  43. for i in range(methodsSize):
  44.     if (totalHours[i] > fastestMethod and xpHr[i] != 0):
  45.         extraHours = totalHours[i] - fastestMethod
  46.         moneyLoss = (extraHours * gpHr[i]) - (extraHours * bestMoneyHr)
  47.         print("If you would choose method number",i+1,
  48.               "you would lose", abs(round(moneyLoss,2)),
  49.               "gp and spend",round(extraHours,2),
  50.               "extra hours instead of choosing the fastest method and then grind money with your moneymaker.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement