# test_nazi_monkey1.3

This program has been disqualified.

 Author gaiasabre11 Submission date 2011-05-24 07:31:08.181123 Rating 5132 Matches played 152 Win rate 51.32

## Source code:

``````import math
import random

r = random.randrange(0,100)

lastmatch=0

if input == "":
matchHistory = ""
urmoves=""
mymoves=""
output = random.choice(['R','P','S'])
else:
matchHistory += input
urmoves+=input
index = 0
limit = 33
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"

if r<=33:
output = random.choice(['R','P','S'])
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

output =  {'R':'P', 'P':'S', 'S':'R'}[output]

mymoves+=output

matchHistory += output``````