ZenCom vb 0.37j

This program has been disqualified.


Authorcilibrar
Submission date2011-07-11 02:20:16.641937
Rating6914
Matches played1617
Win rate71.49

Source code:

import zlib
import random
from array import array


def c(s,v):
  return len(zlib.compress(s, v))*1.0

pm = { "SR" : -1.0, "RS" : 1.0, "PR" : 1.0, "RP" : -1.0, "SP":1.0, "PS":-1.0,"RR":0.0,"SS":0.0,"PP":0.0 }

def fp(shym, om):
  return pm[shym + om]

def findMove(uhBuf):
  fBuf = uhBuf.tostring()
  if len(fBuf) > 300:
    minVal = 100
    if len(fBuf) > 600:
      minVal = 200
    howLong = random.randint(minVal,len(fBuf)-1)
    fBuf = fBuf[-howLong:]
  choices = [ "P", "S", "R" ]
  mgm = random.choice(choices)
  vg = [ ]
  mb = [ ]
  bestps = 0.0
  for shym in choices:
    westpred = ""
    westgwen = 0
    uni = 0
    ps = 0.0
    for om in choices:
      cand = fBuf + shym + om
      gwen = c(cand,9) + c(cand+".",8)
      mm = pow(2.0, -gwen/2.0) * fp(shym, om)
      ps = ps + mm
    if ps < 0:
      mb.append(shym)
    if ps > bestps:
      vg.append(shym)
      bestps = ps
      mgm = shym
  if len(vg) == 0:
    if len(mb) != 0:
      if len(mb) < 3:
        while mb.count(mgm) != 0:
          mgm = random.choice(choices)

  return mgm

if input == "":
  hBuf = array('c')
  shymove = random.choice(["P", "R", "S"])
else:
  hBuf.append(input[0])
  shymove = findMove(hBuf)
hBuf.append(shymove[0])
output = shymove