CopyFindX2-Meta (fixed)

This program has been disqualified.


Authordavid.werecat
Submission date2013-11-19 03:15:57.641080
Rating4535
Matches played178
Win rate48.31

Source code:

#Created by David Catt (2013)
#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