This program has been disqualified.

 Author momo Submission date 2012-04-11 19:05:47.056031 Rating 7151 Matches played 168 Win rate 71.43

## Source code:

``````import random

def highest(v):
return random.choice([i for i in range(len(v)) if max(v) == v[i]])

def lowest(v):
return random.choice([i for i in range(len(v)) if min(v) == v[i]])

def best(c):
return highest([c-c, c-c, c-c])

def mean(c):
return sum(c)/length(c)

# alpha in [0,1]: greediness
def attack(yo, tu, alpha):
r = res[yo][tu]
p1 = yo
if r == -1:
p1 = (yo + 1) % 3
elif r == 0 and random.random() < alpha:
p1 = (yo + 2) % 3
return p1

def attackpa(pa, alpha):
yo = pa
tu = pa
r = res[yo][tu]
p1 = yo
if r == -1:
p1 = (yo + 1) % 3
elif r == 0 and random.random() < alpha:
p1 = (yo + 2) % 3
return p1

if(1):
if (input == ""):
N = 1
AR1 = .95#0.85
states = ["R","S","P"]
st = [0,1,2]
dna = [0,1,2,3,4,5,6,7,8,9]
dnadic = {(0,0): 0,(1,0): 1,(2,0): 2,
(0,1): 3,(1,1): 4,(2,1): 5,
(0,2): 6,(1,2): 7,(2,2): 8}
pairs = [(0,0),(1,0),(2,0), (0,1),(1,1),(2,1), (0,2),(1,2),(2,2)]
sdic = {"R":0, "S":1, "P":2}

forwardbias = 2
res = [[0, 1, -1], [-1, 0, 1], [1, -1, 0]]
MEM1 = MEM2 = MEM3 = []

h = 5 #10
MEM5 = [0,0,1,2,4] #000114

M5 = len(MEM5)

M = M5 + 1
models = ([1, 0, 0]*M)

state =  * (M*3)

yo = random.choice(st)
tu = random.choice(st)

pa = (yo, tu)
hi = [pa]
hiyt = states[yo]+states[tu]
hit = states[yo]+" "
hiy = " " + states[tu]
choices = []
prognosis = [random.choice(st) for i in range(M*3)]

else:
tu = sdic[input]
pa = (yo,tu)
hi += [pa]

hiyt += states[yo]+states[tu]
hit += states[yo]+" "
hiy += " " + states[tu]
state = [ AR1 * state[i] + res[prognosis[i]][tu] * models[i] for i in range(M*3)]

prognosis = [random.choice(st) for l in range(M*3)]
i = -3
prob= [0,0,0, 0,0,0, 0,0,0]

for k in MEM5:
prob0 = [0,0,0, 0,0,0, 0,0,0]
if k == 0:
for j in range(h):
r = max([random.choice(range(N)) for l in range(forwardbias)])

i += 3; prognosis[i] = attackpa(pairs[highest(prob0)],0.85);

if 0 < k and k < N:
for j in range(h):
r = max([random.choice(range(N-k)) for l in range(forwardbias)])
z = ((yo + hi[r+k] - hi[r])%3,((tu + hi[r+k] - hi[r]) % 3))
i += 3; prognosis[i] = attackpa(pairs[highest(prob0)],0.85);

best = highest(state)
yo = prognosis[best] #0  5

output = states[yo]

N = N + 1``````