# Mediocre Bombard

This program has been disqualified.

 Author dllu Submission date 2011-05-25 17:41:21.118577 Rating 5788 Matches played 1092 Win rate 57.88

## Source code:

``````import random

limit = [1,6,10,16]
lastmatch=0

best=-100

if not input:
urmoves=""
mymoves=""
output=random.choice(['R','P','S'])
predictorscore=[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]
oldpredictors=predictors=['P','P','P','P','P','P','P','P']

length=0

rockRating = scissorsRating = paperRating = 0
rockRating2 = scissorsRating2 = paperRating2 = 0
else:
for i in range(8):
predictors[i]=random.choice(['R','P','S'])
predictorscore[i]*=0.87
if input==oldpredictors[i]:
predictorscore[i]+=0.13
elif input=={'R':'S', 'P':'R', 'S':'P'}[oldpredictors[i]]:
predictorscore[i]-=0.10
else:
predictorscore[i]-=0.03

#Predictor 0-8: History matching
urmoves+=input
length+=1
done=[0,0,0,0]

for i in range(length-1,17,-1):
match=0
j=1
while j<=i and urmoves[i-j]==urmoves[length-j]:
match+=1
if match>lastmatch:
lastmatch=match
for k in range(4):
if match>limit[k] and not done[k]:
predictors[k]=urmoves[i]
predictors[k+4]=mymoves[i]
done[k]=1
if done==[1,1,1,1]:
break
j+=1

if done==[1,1,1,1]:
break

for i in range(4,8):
predictors[i] = {'R':'P','P':'S','S':'R'}[predictors[i]]

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

output = {'R':'P','P':'S','S':'R'}[output] #attempt to win
if length%23==11 or best<0:
output = random.choice(['R','P','S'])
mymoves+=output

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