Nebelwerfer

This program has been disqualified.

 Author dllu Submission date 2011-05-23 20:33:20.888062 Rating 8029 Matches played 208 Win rate 80.29

Source code:

``````import random

lastmatch =0
lastmatch1=0
lastmatch2=0

limit = 30

predictors=range(18)

for i in range(18):
predictors[i]=random.choice(['R','P','S'])

if not input:
oldpredictors=range(18)
urmoves=""
mymoves=""
output=random.choice(['R','P','S'])
predictorscore=[1.2,0.7,0.7,0.6,0.6,0.6,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1]
else:
for i in range(18):
predictorscore[i]*=0.8
predictorscore[i]+=(input==oldpredictors[i])/10.0
predictorscore[i]-=(input=={'R':'S', 'P':'R', 'S':'P'}[oldpredictors[i]])/10.0

#Predictor 0-11: History matching
urmoves+=input
done=0
done1=0
done2=0
for i in range(len(urmoves)-1,limit+1,-1):
match=0
j=1
while j<=i and mymoves[i-j]==mymoves[len(urmoves)-j] and urmoves[i-j]==urmoves[len(urmoves)-j] and not done:
match+=1
if match>lastmatch:
lastmatch=match
predictors[0]=urmoves[i]
predictors[1]=mymoves[i]
if match>limit:
done=1
break
j+=1
match=0
j=1
while j<=i and mymoves[i-j]==mymoves[len(urmoves)-j] and not done1:
match+=1
if match>lastmatch1:
lastmatch1=match
predictors[2]=urmoves[i]
predictors[3]=mymoves[i]
if match>limit:
done1=1
break
j+=1
match=0
j=1
while j<=i and urmoves[i-j]==urmoves[len(urmoves)-j] and not done2:
match+=1
if match>lastmatch2:
lastmatch2=match
predictors[4]=urmoves[i]
predictors[5]=mymoves[i]
if match>limit:
done2=1
break
j+=1

predictors[1]={'R':'S', 'P':'R', 'S':'P'}[predictors[1]]
predictors[3]={'R':'S', 'P':'R', 'S':'P'}[predictors[3]]
predictors[5]={'R':'S', 'P':'R', 'S':'P'}[predictors[5]]
for i in range(6,18):
predictors[i]={'R':'S', 'P':'R', 'S':'P'}[predictors[i-6]]

#compare predictors
best=-100
for i in range(18):
if predictorscore[i]>best:
output = predictors[i]
best = output

output = {'R':'P','P':'S','S':'R'}[output] #attempt to win
mymoves+=output

for i in range(18):
oldpredictors[i]=predictors[i]``````