Advertisement
Guest User

Untitled

a guest
May 19th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.00 KB | None | 0 0
  1. # import random so we can generate a random number
  2. import random
  3.  
  4. chance_of_leggy = []
  5. total_voter_keys_used = []
  6. total_common_keys_used = []
  7. total_rare_keys_used = []
  8. total_epic_keys_used = []
  9. total_leggy_keys_received = []
  10. all_keys = []
  11. trials = 1000
  12. trial_hold = trials
  13.  
  14. while trials > 0:
  15.    
  16.     trials -= 1
  17.  
  18.     # Set the default amounts of each type of key we have available to us
  19.  
  20.     vote_keys_available = 1000000
  21.     start_keys = vote_keys_available
  22.     common_keys_available = 0
  23.     rare_keys_available = 0
  24.     epic_keys_available = 0
  25.     leggy_keys_available = 0
  26.  
  27.  
  28.     vote_keys_used = 0
  29.     common_keys_used = 0
  30.     rare_keys_used = 0
  31.     epic_keys_used = 0
  32.  
  33.     def rand():
  34.         return random.uniform(0, 100)
  35.  
  36.     # % for voters
  37.  
  38.     voter_voter_x2 = 5.67
  39.     voter_common = voter_voter_x2 + 4.05
  40.     voter_rare = voter_common + 3.24
  41.  
  42.     # % for common
  43.  
  44.     common_common_x2 = 5.48
  45.     common_rare = common_common_x2 + 3.13
  46.  
  47.     # % for rare
  48.  
  49.     rare_rare_x2 = 5.6
  50.     rare_epic = rare_rare_x2 + 0.56
  51.  
  52.     # % for epic
  53.  
  54.     epic_epic_x2 = 9.61
  55.     epic_leggy = epic_epic_x2 + 2.4
  56.  
  57.     # General
  58.  
  59.     voter_gotten = 0
  60.     common_gotten = 0
  61.     rare_gotten = 0
  62.     epic_gotten = 0
  63.  
  64.     # Spin voter keys
  65.  
  66.     while vote_keys_available > 0:
  67.         vote_keys_available -= 1
  68.         spin = rand()
  69.         if spin <= voter_voter_x2:
  70.             voter_gotten += 2
  71.             vote_keys_available += 2
  72.         elif spin <= voter_common:
  73.             common_gotten += 1
  74.             common_keys_available += 1
  75.         elif spin <= voter_rare:
  76.             rare_gotten += 1
  77.             rare_keys_available += 1
  78.         vote_keys_used += 1
  79.  
  80.     # Spin common keys
  81.  
  82.     while common_keys_available > 0:
  83.         common_keys_available -= 1
  84.         spin = rand()
  85.         if spin <= common_common_x2:
  86.             common_gotten += 2
  87.             common_keys_available += 2
  88.         elif spin <= common_rare:
  89.             rare_gotten += 1
  90.             rare_keys_available += 1
  91.         common_keys_used += 1
  92.  
  93.     # Spin rare keys
  94.  
  95.     while rare_keys_available > 0:
  96.         rare_keys_available -= 1
  97.         spin = rand()
  98.         if spin <= rare_rare_x2:
  99.             rare_gotten += 2
  100.             rare_keys_available += 2
  101.         elif spin <= rare_epic:
  102.             epic_gotten += 1
  103.             epic_keys_available += 1
  104.         rare_keys_used += 1
  105.  
  106.     # Spin epic keys
  107.  
  108.     while epic_keys_available > 0:
  109.         epic_keys_available -= 1
  110.         spin = rand()
  111.         if spin <= epic_epic_x2:
  112.             epic_gotten += 2
  113.             epic_keys_available += 2
  114.         elif spin <= epic_leggy:
  115.             leggy_keys_available += 1
  116.         epic_keys_used += 1
  117.  
  118.     # Calculations
  119.  
  120.     all_keys.append(vote_keys_used + common_keys_used + rare_keys_used + epic_keys_used)
  121.     sim_chance_of_leggy = leggy_keys_available/total_keys_used
  122.     chance_of_leggy.append(sim_chance_of_leggy)
  123.     total_voter_keys_used.append(vote_keys_used)
  124.     total_common_keys_used.append(common_keys_used)
  125.     total_rare_keys_used.append(rare_keys_used)
  126.     total_epic_keys_used.append(epic_keys_used)
  127.     total_leggy_keys_received.append(leggy_keys_available)
  128.    
  129. def avg(list):
  130.     return sum(list)/len(list)
  131.    
  132. final_avg = avg(chance_of_leggy)
  133. final_voters = avg(total_voter_keys_used)
  134. final_commons = avg(total_common_keys_used)
  135. final_rares = avg(total_rare_keys_used)
  136. final_epics = avg(total_epic_keys_used)
  137. final_leggy = avg(total_leggy_keys_received)
  138. final_keys = avg(all_keys)
  139.  
  140.  
  141.  
  142. print('Simulation run {} times\nAverage keys opened (starting with {:,.2f}): {:,.2f}\nAverage amount of VOTER keys opened: {:,.2f}\nAverage amount of COMMON keys opened: {:,.2f}\nAverage amount of RARE keys opened: {:,.2f}\nAverage amount of EPIC keys opened: {:,.2f}\nAverage amount of LEGENDARY keys received: {}\n% Chance of receiving a legendary key from a voter key: {}'.format(
  143. trial_hold, start_keys, final_keys, final_voters, final_commons, final_rares, final_epics, final_leggy, final_avg))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement