This program has been disqualified.
Author | david.werecat |
Submission date | 2013-11-15 10:43:55.862154 |
Rating | 4807 |
Matches played | 173 |
Win rate | 50.87 |
#Created by David Catt (2013) about 7 months after the original
#Finds the highest order matching context and copies output
import random
if input == "":
maxord = 11
result = {"RR":0,"RP":-1,"RS":1,"PR":1,"PP":0,"PS":-1,"SR":-1,"SP":1,"SS":0}
winmap = {"R":"P","P":"S","S":"R"}
losmap = {"R":"S","P":"R","S":"P"}
valmap = {"R":1,"P":2,"S":3}
models = ["R"] * 7
weight = [0.0] * 7
preval = ["R"] * 7
maxctx = 4**maxord
otbl = ["-"] * maxctx
octx = 0
ttbl = ["-"] * maxctx
tctx = 0
last = "R"
else:
tmp = maxctx
for i in range(0, maxord):
otbl[octx % tmp] = input
ttbl[tctx % tmp] = input
tmp /= 4
octx = ((4 * octx) + valmap[last]) % maxctx
tctx = ((4 * tctx) + valmap[input]) % maxctx
tmp = maxctx
output = ""
oout = ""
tout = ""
bprb = -10000.0
for i in range(0, maxord):
if oout == "":
if otbl[octx % tmp] != "-":
oout = winmap[otbl[octx % tmp]]
if tout == "":
if ttbl[tctx % tmp] != "-":
tout = winmap[ttbl[tctx % tmp]]
tmp /= 4
if tout == "":
tout = random.choice(["R","P","S"])
if oout == "":
oout = random.choice(["R","P","S"])
models[0] = tout
models[1] = winmap[tout]
models[2] = losmap[tout]
models[3] = oout
models[4] = winmap[oout]
models[5] = losmap[oout]
models[6] = random.choice(["R","P","S"])
if input == "":
output = models[6]
else:
for i in range(0, 7):
weight[i] *= 0.91
weight[i] += result[preval[i] + input]
if weight[i] > bprb:
output = models[i]
for i in range(0, 7):
preval[i] = models[i]
last = output