This program has been disqualified.
Author | dllu |
Submission date | 2011-07-08 22:16:37.596639 |
Rating | 1494 |
Matches played | 1537 |
Win rate | 20.88 |
import re
if not input:
moves=''
centrifuge={'RP':'a','PS':'b','SR':'c','PR':'d','SP':'e','RS':'f','RR':'g','PP':'h','SS':'i'}
score=0
length=0
else:
moves+=centrifuge[input+output]
length+=1
if input==best:
score-=1
elif input==best0:
score+=1
j=10
k={}
while j>=1 and not moves[length-j:length] in moves[0:length-1]:
j-=1
for x in "abcdefghi":
k[x] = len(re.findall(r'(?<=%s)(%s)' % (moves[length-j:length], x), moves[0:length-1]))
kR =k['a']+k['f']+k['g']
kP =k['b']+k['d']+k['h']
kS =k['c']+k['e']+k['i']
kR0=k['c']+k['d']+k['g']
kP0=k['a']+k['e']+k['h']
kS0=k['b']+k['f']+k['i']
best ="RPS"[[kR -kS ,kP -kR ,kS -kP ].index(max([kR -kS ,kP -kR ,kS -kP ]))]
best0="PSR"[[kR0-kS0,kP0-kR0,kS0-kP0].index(max([kR0-kS0,kP0-kR0,kS0-kP0]))]
if score<=0:
output=best
else:
output=best0