This program has been disqualified.
Author | gaiasabre11 |
Submission date | 2011-05-28 09:22:00.762619 |
Rating | 5737 |
Matches played | 4227 |
Win rate | 58.03 |
import random
lastmatch=0
r = random.randrange(0,100)
if not input:
urmoves=""
mymoves=""
output = random.choice(['R','P','S'])
matchHistory = ""
count1 = count2 = count3 = 0
else:
matchHistory += input
if input == lastMove:
offset += 1
if (input=="R" and lastMove=="S") or (input=="P" and lastMove=="R") or (input=="S" and lastMove=="P"):
offset += 2
offset = offset%3
if offset == 0:
count1 += 1
elif offset == 1:
count2 += 1
else:
count3 += 1
urmoves+=input
prediction = random.choice(["R","P","S"])
index = 0
longestMatch = 0
limit = 50
while index < len(matchHistory)-1:
index2 = index
index3 = len(matchHistory)-1
length = 0
while index2 >= 0:
if matchHistory[index2] != matchHistory[index3]:
break
index2 -= 1
index3 -= 1
length += 1
if length > limit:
break
if length > longestMatch:
longestMatch = length
prediction = matchHistory[index+1]
if length > limit:
break
index += 1
if (count1 > count2) and (count1 > count3):
offset = 0
output = prediction
elif (count2 > count3):
offset = 1
output = {'R':'P', 'P':'S', 'S':'R'}[prediction]
else:
offset = 2
output = {'R':'S', 'P':'R', 'S':'P'}[prediction]
if r<30:
for i in range(len(urmoves)-1,20,-1):
match=0
j=1
while mymoves[i-j]==mymoves[len(urmoves)-j]:
match+=1
if match>lastmatch:
lastmatch=match
output=urmoves[i]
if match>20:
break
j+=1
mymoves += output
lastMove = output