CompressorKong

This program has been disqualified.


AuthorEbTech
Submission date2011-05-23 02:07:06.683247
Rating6550
Matches played4812
Win rate65.27

Source code:

import random
if input == "":
	matchHistory = ""
else:
	matchHistory += input
        matchHistory += lastoutput
prediction = random.choice(["R","P","S"])
index = 0
longestMatch = 0
limit = 50
while index < len(matchHistory)-2:
	index2 = index
	index3 = len(matchHistory)-2
	length = 0
	while index2 >= 0:
		if matchHistory[index2] != matchHistory[index3] or matchHistory[index2+1] != matchHistory[index3+1]:
			break
		index2 -= 2
		index3 -= 2
		length += 1
		if length > limit:
			break
	if length > longestMatch:
		longestMatch = length
		prediction = matchHistory[index+2]
	if length > limit:
		break
	index += 2
output = {'R':'P', 'P':'S', 'S':'R'}[prediction]
lastoutput = output