CopyFindX2-Meta0 (fixed)

This program has been disqualified.


Authordavid.werecat
Submission date2013-11-19 03:13:25.811533
Rating7384
Matches played180
Win rate74.44

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"] * 6
    weight = [0.0] * 6
    preval = ["R"] * 6
    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]
if input == "":
    output = random.choice(["R","P","S"])
else:
    for i in range(0, 6):
        weight[i] *= 0.91
        weight[i] += result[preval[i] + input]
        if weight[i] > bprb:
            output = models[i]
            bprb = weight[i]
for i in range(0, 6):
    preval[i] = models[i]

last = output