B300

AuthorTheCrouchMode
Submission date2016-01-15 12:41:19.976722
Rating5842
Matches played456
Win rate57.89

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

Source code:

import random
import collections

size = 300

try:
    prev
except NameError:
    prev = collections.deque([])

output = ""

if input == "":
    for i in range(size):
        prev.append(random.choice(["R", "P", "S"]))
    output = random.choice(["R", "P", "S"])
else:
    prev.appendleft(input)
    prev.pop()
    guess = random.choice(prev)
    
    if guess == "R":
        output = "P"
    elif guess == "P":
        output = "S"
    elif guess == "S":
        output = "R"