ZenCom vb 0.1c

This program has been disqualified.


Authorcilibrar
Submission date2011-07-03 03:11:51.364462
Rating7345
Matches played1768
Win rate71.27

Source code:

import zlib
import random


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

def fp(shym, om):
  if shym == om:
    return 0.0
  mom=shym+om
  if mom == "SR":
    return -1.0
  if mom == "RS":
    return 1.0
  if mom == "PR":
    return 1.0
  if mom == "RP":
    return -1.0
  if mom == "SP":
    return 1.0
  if mom == "PS":
    return -1.0
  return 0.0

def findMove(shyHist, oHist):
  choices = [ "P", "S", "R" ]
  mgm = random.choice(["P", "R", "S"])
  vg = [ ]
  mb = [ ]
  hBuf =  "".join(i for j in zip(shyHist,oHist) for i in j)
  for shym in choices:
    westpred = ""
    westgwen = 0
    uni = 0
    for om in choices:
      cand = hBuf + shym + om
      gwen = c(cand+".")
      if westpred == "" or westgwen > gwen:
        westgwen = gwen
        westpred = om
        uni = 0
      else:
        if westgwen == gwen:
          uni = 1
    if uni == 1:
      westpred = ""
    if westpred != "":
      p = fp(shym, westpred)
      if p < 0:
        mb.append(shym)
      if p > 0:
        vg.append(shym)
    if len(vg) != 0:
      mgm = random.choice(vg)
    else:
      if len(mb) != 0:
        if len(mb) < 3:
          while mb.count(mgm) != 0:
            mgm = random.choice(choices)

  return mgm

if input == "":
  bareLogo = ""
  shyLogo = ""
  shymove = random.choice(["P", "R", "S"])
else:
  bareLogo = bareLogo + input
  shymove = findMove(shyLogo, bareLogo)
shyLogo = shyLogo + shymove
output = shymove