# mem2dbt

This program has been disqualified.

 Author momo Submission date 2011-06-14 01:11:43.785952 Rating 6315 Matches played 3232 Win rate 62.84

## 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])

if (1):
if (input == ""):
N = 1
cutoff = 400
AR1 = 0.87
states = ["R","S","P"]
st = [0,1,2]
sdic = {"R":0, "S":1, "P":2}
decay = 0.0
decay2 = 0.5
res = [[0, 1, -1], [-1, 0, 1], [1, -1, 0]]
total=0
r=0
M = 4
models = *(M*3+1)

state = [2.24, -3.36, 1.12, -1.25, 1.37, -0.12, 0.97, 0.31, -1.29, 0.63, 0.83, -1.46, 2.12]#*(M*3+1)
yo = random.choice(st)
tu = random.choice(st)

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

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

state = [ AR1 * state[i] + res[prognosis[i]][tu] * models[i] for i in range(M*3+1)]

r = res[yo][tu]
total = total + r

if 1:
count =  [* 3]* 6
for pos in range(max(3, cutoff), N-1):
if (hi[pos-1] == hi[N-2] and hi[pos] == hi[N-1]):
count[hi[pos-2]] += 1 + pos * decay
count[hi[pos-2]] += 1 + pos * decay
if (hi[pos-1] == hi[N-2] and hi[pos-1] == hi[N-1]):
count[hi[pos-2]] += 1 + pos * decay
count[hi[pos-2]] += 1 + pos * decay
if (hi[pos-1] == hi[N-2] and hi[pos-1] == hi[N-1]):
count[hi[pos-2]] += 1 + pos * decay
count[hi[pos-2]] += 1 + pos * decay

prop =  [random.choice(st) for i in range(6)]
for pos in range(N-1,max(3, cutoff),-1):
if (hi[pos-1] == hi[N-2] and hi[pos] == hi[N-1]):
prop = hi[pos-2]
if (random.random() < decay2): break
for pos in range(N-1,max(3, cutoff),-1):
if (hi[pos-1] == hi[N-2] and hi[pos] == hi[N-1]):
prop = hi[pos-2]
if (random.random() < decay2): break

prognosis = (lowest([count[i] + count[i] + count[i] for i in range(3)]) +1) % 3
prognosis = (highest([count[i] + count[i] + count[i] for i in range(3)]) +1) % 3
prognosis = (highest([count[i] + count[i] + count[i] for i in range(3)]) +1) % 3
prognosis = (lowest([count[i] + count[i] + count[i] for i in range(3)]) +1) % 3

# modelrandom
prognosis[3*M] = (random.choice(hi) + 2) % 3
prognosis[3*M] = random.choice(st)

for i in range(M):
prognosis[i*3 + 1] = (prognosis[i*3] + 1) % 3
prognosis[i*3 + 2] = (prognosis[i*3+1] + 1) % 3

thebest = highest(state)

choices += [thebest]

yo = prognosis[thebest]

output = states[yo]

N = N + 1``````