ZenCom vb 0.37i

This program has been disqualified.


Authorcilibrar
Submission date2011-07-03 04:23:57.740372
Rating7249
Matches played292
Win rate71.92

Source code:

import zlib
import random


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(hBuf):
  choices = [ "P", "S", "R" ]
  mgm = random.choice(choices)
  vg = [ ]
  mb = [ ]
  bestps = 0.0
  offset = c(hBuf,9) + c(hBuf + ".",9)
  for shym in choices:
    westpred = ""
    westgwen = 0
    uni = 0
    ps = 0.0
    for om in choices:
      cand = hBuf + shym + om
      gwen = c(cand,9) + c(cand+".",9)
      pm = pow(2.0, -(gwen-offset)/2.0) * fp(shym, om)
      ps = ps + pm
    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 = ""
  shymove = random.choice(["P", "R", "S"])
else:
  hBuf = hBuf + input
  shymove = findMove(hBuf)
hBuf = hBuf + shymove
output = shymove