Mbuzi-v0.2

Authormcg
Submission date2011-07-12 04:34:52.712002
Rating5314
Matches played4259
Win rate57.74

Use rpsrunner.py to play unranked matches on your computer.

Source code:

# Mbuzi-v0.2 by mcg

import random
beat = {'R':'P','P':'S','S':'R'}
rps = "RPS"
histlen = 30

if input == "":
   lastmoves = ""
   rounds = 0
   output = random.choice(rps)
else:
   rounds = rounds + 1
   lastmoves = (lastmoves + input)[-histlen:]
   if rounds < histlen:
      output = random.choice(rps)
   else:
      output = beat[random.choice(lastmoves)]