u170108082

AuthorIvan Eloff
Submission date2019-02-07 14:51:01.236886
Rating4778
Matches played252
Win rate46.83

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

Source code:

import random

def predict(x):
    if x == "R":
        return "P"
    elif x == "P":
        return "S"
    else:
        return "R"

if input == "": 
   active_state = random.choice(["R", "P", "S"])
   prev_state = random.choice(["R", "P", "S"])
elif input != active_state and input == prev_state:
    active_state = input
else:
    prev_state = input

output = predict(active_state)