Author | Gary |
Submission date | 2019-02-04 16:50:11.224165 |
Rating | 4352 |
Matches played | 252 |
Win rate | 40.87 |
Use rpsrunner.py to play unranked matches on your computer.
R = 0;
P = 0;
S = 0;
str = []
if input == "": # initialize variables for the first round
R = P = S = 0
elif input == "R":
R += 1
str.append("R")
elif input == "P":
P += 1
str.append("P")
elif input == "S":
S += 1
str.append("S")
temp=""
if(len(str)>=9):
temp = str.pop(0)
elif temp == "R":
R -= 1
elif temp == "P":
P -= 1
elif temp == "S":
S -= 1
if R > P and R > S:
output = "P" # paper beats rock
elif P > S:
output = "S" # scissors beats paper
else:
output = "R" # rock beats scissors