This program has been disqualified.
Author | dllu |
Submission date | 2011-05-25 17:56:42.926215 |
Rating | 5538 |
Matches played | 87 |
Win rate | 55.17 |
import random
limit = [1,6,10,16]
lastmatch=0
best=-100
if not input:
urmoves=""
mymoves=""
output=random.choice(['R','P','S'])
predictorscore=range(48,0,-2)
oldpredictors=predictors=['P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P','P']
length=0
rockRating = scissorsRating = paperRating = 0
rockRating2 = scissorsRating2 = paperRating2 = 0
else:
for i in range(24):
predictors[i]=random.choice(['R','P','S'])
predictorscore[i]*=0.87
if input==oldpredictors[i]:
predictorscore[i]+=13.0
elif input=={'R':'S', 'P':'R', 'S':'P'}[oldpredictors[i]]:
predictorscore[i]-=10.0
else:
predictorscore[i]-=3.0
#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]]
for i in range(8,24):
predictors[i] = {'R':'S','P':'R','S':'P'}[predictors[i-8]]
#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%61==11 or best<0:
output = random.choice(['R','P','S'])
mymoves+=output
for i in range(24):
oldpredictors[i]=predictors[i]