Author | TidyMaze |
Submission date | 2018-08-26 15:10:12.997194 |
Rating | 3438 |
Matches played | 282 |
Win rate | 34.4 |
Use rpsrunner.py to play unranked matches on your computer.
def beating(symb):
return {
"R": "P",
"P": "S",
"S": "R"
}.get(symb)
if input == "": # initialize variables for the first round
rockCount = paperCount = scissorsCount = 0
elif input == "R":
rockCount += 1
elif input == "P":
paperCount += 1
elif input == "S":
scissorsCount += 1
if rockCount > paperCount and rockCount > scissorsCount:
output = beating("R")
elif paperCount > scissorsCount:
output = beating("P")
else:
output = beating("S")