Advertisement
Hydreigon_Lord

More Accurate ROFC Simulation

Jun 27th, 2017
759
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.57 KB | None | 1 0
  1. # ROFC Simulation
  2.  
  3. import random
  4. import time
  5. SIMS=10000000 # Number of simulations to run
  6. MINSCORE=0 # Lower cap of event scores
  7. MAXSCORE=10000 # Upper cap of event scores
  8. AVGSCORE=5000 # Average event score
  9. STDEV=1000 # Standard deviation of event scores
  10. CONTS=5 # Number of contestants
  11. MULTS=[6,7,10,15,0] # Multipliers as the competition progresses (yes, the 0 at the end is necessary)
  12. prediction=[]
  13. for i in range(CONTS):
  14.     prediction.append([0,0,0,0,0]) # Make sure the list contains as many 0s as there are CONTS.
  15.     for i in range(SIMS):
  16.     if i==0:
  17.         t1=time.time()
  18.     scores=[197316,183783,182875,178904,177055] # Contestant scores
  19.     conts=5 # Do not forget to change this CONTS as well!
  20.     assert len(scores)==conts, 'CONTS constant must equal length of scores list'
  21.     while conts>0:
  22.         lowestScore=MAXSCORE**3
  23.         worstCont=-1
  24.         for cont in range(len(scores)):
  25.             if scores[cont]!=None:
  26.                 toadd=random.normalvariate(AVGSCORE,STDEV)
  27.                 if toadd>MAXSCORE:
  28.                     toadd=MAXSCORE
  29.                 elif toadd<MINSCORE:
  30.                     toadd=MINSCORE
  31.                 scores[cont]+=toadd*MULTS[CONTS-conts]
  32.                 if scores[cont]<lowestScore:
  33.                     lowestScore=scores[cont]
  34.                     worstCont=cont
  35.         scores[worstCont]=None
  36.         conts-=1
  37.         prediction[worstCont][conts]+=1
  38.     if i==0:
  39.         t2=time.time()
  40.         texp=(t2-t1)*(SIMS-1)
  41.         print('This should take about %s seconds.' % texp)
  42. print('Prediction: %s' % prediction)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement