This program has been disqualified.
Author | Byron Knoll |
Submission date | 2011-05-29 22:34:33.990418 |
Rating | 6660 |
Matches played | 2262 |
Win rate | 68.74 |
import random
if input=="":
matchHistory = ""
else:
matchHistory += 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 random.random() < 0.5:
output = {'R':'P', 'P':'S', 'S':'R'}[prediction]
else:
output = prediction