SelfCopyO2

Authordavid.werecat
Submission date2013-02-08 15:02:05.389388
Rating6444
Matches played715
Win rate66.43

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

Source code:

if input == "":
    last = ["R"] * 9
    prev = "R"
    ctx = 0
else:
    last[ctx] = input
    ctx = ((ctx * 3) + {"R":0,"P":1,"S":2}[prev]) % 9
output = prev = {"R":"P","P":"S","S":"R"}[last[ctx]]