Boltzmann Compressor

This program has been disqualified.


AuthorEbTech
Submission date2011-05-23 02:38:27.371445
Rating7750
Matches played200
Win rate77.5

Source code:

import math

if input == "":
	matchHistory = ""
else:
	matchHistory += input
index = 0
limit = 50
heatR = heatP = heatS = 0
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
	predict = matchHistory[index+3]
        energy = math.pow(length+1, math.log(length+1)+1)
        if predict == 'R':
                heatP += energy
                heatS -= energy
        elif predict == 'P':
                heatS += energy
                heatR -= energy
        else:
                heatR += energy
                heatP -= energy
	index += 2
if heatR > heatP and heatR > heatS:
    output = "R"
elif heatP > heatS:
    output = "P"
else:
    output = "S"
matchHistory += output