This program has been disqualified.
Author | dllu |
Submission date | 2011-05-25 18:35:34.226387 |
Rating | 5125 |
Matches played | 4773 |
Win rate | 48.08 |
import random
lastmatch=0
limit = 20
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.6
elif input=={'R':'S', 'P':'R', 'S':'P'}[oldpredictors[i]]:
predictorscore[i]-=0.5
else:
predictorscore[i]-=0.1
predictors[0] = 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:
predictors[0]=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]