Author | Ivan Eloff |
Submission date | 2019-02-07 14:51:01.236886 |
Rating | 4778 |
Matches played | 252 |
Win rate | 46.83 |
Use rpsrunner.py to play unranked matches on your computer.
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)