Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. from random import choice
  2.  
  3. #Colors are R,G,B,W = 0,1,2,3
  4. chance = [800, 0, 5800, 3400] #f, 5*, 4*, 3*
  5. defaultrate = list(chance)
  6. cost = [5,4,4,4,3] #of each summon
  7. islegendary = True #determines if 5* increases
  8. desired = 'W'
  9. orbs = 50
  10.  
  11. #rarity pools by color
  12. poolf = [3,3,3,3]
  13. pool5 = [0,0,0,0]
  14. pool4 = [30,27,18,25]
  15. pool3 = [15,12,9,13]
  16. cpools = [poolf, pool5, pool4, pool3]
  17. rdict = {'f':0, '5':1, '4':2, '3':3}
  18.  
  19.  
  20. def summon():
  21. global orbs
  22. pool = []
  23. rpicker = ['f'] * chance[0] + ['5'] * chance[1] + ['4'] * chance[2] + ['3'] * chance[3]
  24. for i in range(5):
  25. r = choice(rpicker)
  26. cpicker = ['R'] * cpools[rdict[r]][0] + ['G'] * cpools[rdict[r]][1] + ['B'] * cpools[rdict[r]][2] + ['W'] * cpools[rdict[r]][3]
  27. c = choice(cpicker)
  28. pool.append(r+c)
  29. #print(pool)
  30. numpicked = 0
  31. picked = []
  32. for hero in pool:
  33. if hero[1] == desired and orbs >= cost[numpicked]:
  34. picked.append(hero)
  35. orbs -= cost[numpicked]
  36. numpicked += 1
  37. if numpicked is 0:
  38. picked.append(choice(pool))
  39. orbs -= cost[numpicked]
  40. return picked
  41.  
  42. def simulate(i):
  43. global orbs
  44. global chance
  45. goodpulls = 0
  46. totalpulls = 0
  47. pitycounter = 0
  48. #defaultrate = chance
  49. for val in range (i):
  50. print val
  51. orbs = 100
  52. while orbs >= cost[0]:
  53. pulls = summon()
  54. pitybreak = False
  55. for pull in pulls:
  56. if pull == 'f'+desired:
  57. #print(pull)
  58. goodpulls += 1
  59. totalpulls += 1
  60. pitycounter += 1
  61. if pull[0] == 'f' or pull[0] is '5':
  62. #pitycounter = 0
  63. #chance = list(defaultrate)
  64. pitybreak = True
  65. #print defaultrate
  66.  
  67. if pitycounter >= 5:
  68. pitycounter -= 5
  69. chance[0] += 50
  70. chance[2] -= 25
  71. chance[3] -= 25
  72. #print chance
  73. #print defaultrate
  74.  
  75. if pitybreak:
  76. pitycounter = 0
  77. chance = list(defaultrate)
  78. #print("orbs: "+ str(orbs))
  79. chance = list(defaultrate)
  80. #print defaultrate
  81.  
  82.  
  83. print(goodpulls)
  84. print(totalpulls)
  85. print("rate: " + str(1.0*goodpulls/totalpulls))
  86.  
  87. return
  88.  
  89. simulate(10000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement