Author | mcg |
Submission date | 2011-07-12 04:34:52.712002 |
Rating | 5314 |
Matches played | 4259 |
Win rate | 57.74 |
Use rpsrunner.py to play unranked matches on your computer.
# 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)]