This program has been disqualified.
Author | dllu |
Submission date | 2011-06-21 22:36:53.725321 |
Rating | 8079 |
Matches played | 695 |
Win rate | 81.15 |
# WoofWoofWoof
# Woof Woof
# Woof Woof
# Woof Woof
# Woof Centrifugal Bumble-puppy Woof
# Woof Woof
# Woof Woof
# Woof Woof
# WoofWoofWoof
import random
number_of_predictors = 108 #yes, this really has 108 predictors.
number_of_metapredictors = 8 #actually, I lied! This has 864 predictors.
if not input:
limits = [30,11,6]
beat={'R':'P','P':'S','S':'R'}
urmoves=""
mymoves=""
DNAmoves=""
outputs=[random.choice("RPS")]*number_of_metapredictors
predictorscore1=[3]*number_of_predictors
predictorscore2=[3]*number_of_predictors
predictorscore3=[3]*number_of_predictors
predictorscore4=[3]*number_of_predictors
predictorscore5=[3]*(number_of_predictors/2)
predictorscore6=[3]*(number_of_predictors/2)
predictorscore7=[3]*(number_of_predictors/2)
predictorscore8=[3]*(number_of_predictors/2)
nuclease={'RP':'a','PS':'b','SR':'c','PR':'d','SP':'e','RS':'f','RR':'g','PP':'h','SS':'i'}
length=0
predictors=[random.choice("RPS")]*number_of_predictors
metapredictors=[random.choice("RPS")]*number_of_metapredictors
metapredictorscore=[3]*number_of_metapredictors
else:
for i in range(number_of_predictors):
#metapredictor 1
predictorscore1[i]*=0.8
predictorscore1[i]+=(input==predictors[i])*3
predictorscore1[i]-=(input==beat[beat[predictors[i]]])*3
#metapredictor 2: beat metapredictor 1 (probably contains a bug)
predictorscore2[i]*=0.8
predictorscore2[i]+=(output==predictors[i])*3
predictorscore2[i]-=(output==beat[beat[predictors[i]]])*3
#metapredictor 3
predictorscore3[i]+=(input==predictors[i])*3
if input==beat[beat[predictors[i]]]:
predictorscore3[i]=0
#metapredictor 4: beat metapredictor 3 (probably contains a bug)
predictorscore4[i]+=(output==predictors[i])*3
if output==beat[beat[predictors[i]]]:
predictorscore4[i]=0
try:
for i in range(number_of_predictors/2):
#metapredictor 5
predictorscore5[i]*=0.8
predictorscore5[i]+=(input==lamepredictors[i])*3
predictorscore5[i]-=(input==beat[beat[lamepredictors[i]]])*3
#metapredictor 6: beat metapredictor 5 (probably contains a bug)
predictorscore6[i]*=0.8
predictorscore6[i]+=(output==lamepredictors[i])*3
predictorscore6[i]-=(output==beat[beat[lamepredictors[i]]])*3
#metapredictor 7
predictorscore7[i]+=(input==lamepredictors[i])*3
if input==beat[beat[lamepredictors[i]]]:
predictorscore7[i]=0
#metapredictor 8: beat metapredictor 7 (probably contains a bug)
predictorscore8[i]+=(output==lamepredictors[i])*3
if output==beat[beat[lamepredictors[i]]]:
predictorscore8[i]=0
except NameError:
for i in range(number_of_predictors/2):
predictorscore5[i]=0
predictorscore6[i]=0
predictorscore7[i]=0
predictorscore8[i]=0
for i in range(number_of_metapredictors):
metapredictorscore[i]*=0.9
metapredictorscore[i]+=(input==metapredictors[i])*3
metapredictorscore[i]-=(input==beat[beat[metapredictors[i]]])*3
#History matching
urmoves+=input
mymoves+=output
DNAmoves+=nuclease[input+output]
length+=1
for z in range(3):
limit = min([length,limits[z]])
j=limit
while j>=1 and not DNAmoves[length-j:length] in DNAmoves[0:length-1]:
j-=1
if j>=1:
i = DNAmoves.rfind(DNAmoves[length-j:length],0,length-1)
predictors[0+12*z] = urmoves[j+i]
predictors[1+12*z] = beat[mymoves[j+i]]
i = DNAmoves.find(DNAmoves[length-j:length],0,length-1)
predictors[2+12*z] = urmoves[j+i]
predictors[3+12*z] = beat[mymoves[j+i]]
j=limit
while j>=1 and not urmoves[length-j:length] in urmoves[0:length-1]:
j-=1
if j>=1:
i = urmoves.rfind(urmoves[length-j:length],0,length-1)
predictors[4+12*z] = urmoves[j+i]
predictors[5+12*z] = beat[mymoves[j+i]]
i = urmoves.find(urmoves[length-j:length],0,length-1)
predictors[6+12*z] = urmoves[j+i]
predictors[7+12*z] = beat[mymoves[j+i]]
j=limit
while j>=1 and not mymoves[length-j:length] in mymoves[0:length-1]:
j-=1
if j>=1:
i = mymoves.rfind(mymoves[length-j:length],0,length-1)
predictors[8+12*z] = urmoves[j+i]
predictors[9+12*z] = beat[mymoves[j+i]]
i = mymoves.find(mymoves[length-j:length],0,length-1)
predictors[10+12*z] = urmoves[j+i]
predictors[11+12*z] = beat[mymoves[j+i]]
for i in range(36,108):
predictors[i]=beat[beat[predictors[i-36]]] #Trying to second guess me?
lamepredictors=[]
forbidden=[2,3,6,7,10,11]
for i in range(number_of_predictors):
if i%12 not in forbidden:
lamepredictors.append(predictors[i])
metapredictors[0]=predictors[predictorscore1.index(max(predictorscore1))]
metapredictors[1]=beat[predictors[predictorscore2.index(max(predictorscore2))]]
metapredictors[2]=predictors[predictorscore3.index(max(predictorscore3))]
metapredictors[3]=beat[predictors[predictorscore4.index(max(predictorscore4))]]
metapredictors[4]=lamepredictors[predictorscore5.index(max(predictorscore5))]
metapredictors[5]=beat[lamepredictors[predictorscore6.index(max(predictorscore6))]]
metapredictors[6]=lamepredictors[predictorscore7.index(max(predictorscore7))]
metapredictors[7]=beat[lamepredictors[predictorscore8.index(max(predictorscore8))]]
#compare predictors
output = beat[metapredictors[metapredictorscore.index(max(metapredictorscore))]]