Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ROFC Simulation
- import random
- import time
- SIMS=10000000 # Number of simulations to run
- MINSCORE=0 # Lower cap of event scores
- MAXSCORE=10000 # Upper cap of event scores
- AVGSCORE=5000 # Average event score
- STDEV=1000 # Standard deviation of event scores
- CONTS=5 # Number of contestants
- MULTS=[6,7,10,15,0] # Multipliers as the competition progresses (yes, the 0 at the end is necessary)
- prediction=[]
- for i in range(CONTS):
- prediction.append([0,0,0,0,0]) # Make sure the list contains as many 0s as there are CONTS.
- for i in range(SIMS):
- if i==0:
- t1=time.time()
- scores=[197316,183783,182875,178904,177055] # Contestant scores
- conts=5 # Do not forget to change this CONTS as well!
- assert len(scores)==conts, 'CONTS constant must equal length of scores list'
- while conts>0:
- lowestScore=MAXSCORE**3
- worstCont=-1
- for cont in range(len(scores)):
- if scores[cont]!=None:
- toadd=random.normalvariate(AVGSCORE,STDEV)
- if toadd>MAXSCORE:
- toadd=MAXSCORE
- elif toadd<MINSCORE:
- toadd=MINSCORE
- scores[cont]+=toadd*MULTS[CONTS-conts]
- if scores[cont]<lowestScore:
- lowestScore=scores[cont]
- worstCont=cont
- scores[worstCont]=None
- conts-=1
- prediction[worstCont][conts]+=1
- if i==0:
- t2=time.time()
- texp=(t2-t1)*(SIMS-1)
- print('This should take about %s seconds.' % texp)
- print('Prediction: %s' % prediction)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement