This program has been disqualified.
Author | dllu |
Submission date | 2011-05-25 18:24:37.582762 |
Rating | 3761 |
Matches played | 4570 |
Win rate | 33.13 |
import random
lastmatch=0
limit = 23
if not input:
urmoves=""
mymoves=""
output = random.choice(['R','P','S'])
oldpredictors=predictors=['P','P','P']
predictorscore=[3,2,1]
else:
for i in range(3):
predictorscore[i]*=0.87
if input==oldpredictors[i]:
predictorscore[i]+=0.12
elif input=={'R':'S', 'P':'R', 'S':'P'}[oldpredictors[i]]:
predictorscore[i]-=0.10
else:
predictorscore[i]-=0.03
output = random.choice(['R','P','S'])
urmoves+=input
for i in range(len(urmoves)-1,limit+1,-1):
match=0
j=1
while mymoves[i-j]==mymoves[len(urmoves)-j]:
match+=1
if match>lastmatch:
lastmatch=match
if match>limit:
output=urmoves[i]
break
j+=1
if match>limit:
break
for i in range(1,3):
predictors[i] = {'R':'S','P':'R','S':'P'}[predictors[i-1]]
best = -1
for i in range(3):
if predictorscore[i]>best:
output = predictors[i]
best = predictorscore[i]
if len(mymoves)%101==11 or best<0:
output = random.choice(['R','P','S'])
output = {'R':'P','P':'S','S':'R'}[output]
mymoves+=output
for i in range(3):
oldpredictors[i]=predictors[i]