Decaying Weight

AuthorWeichen Wang
Submission date2013-03-14 11:23:44.528426
Rating6129
Matches played723
Win rate61.13

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

Source code:

import random

plays = ["R","P","S"]
counter = {"R":"P", "P":"S", "S":"R"}

if input == "":
    round = 0
    hist = []
    output = "R"
else:
    if round<100:
      hist.append(input)
      output = random.choice(plays)
    else:
      hist[round % 100] = input
      guess = random.choice(hist)
      output = counter[guess]
    round += 1