Author | mgd020 |
Submission date | 2019-03-14 10:22:28.759978 |
Rating | 5169 |
Matches played | 247 |
Win rate | 48.58 |
Use rpsrunner.py to play unranked matches on your computer.
import random
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:
# rock is most common
if paperCount > scissorsCount:
choices = "PPPSSR"
else:
choices = "PPPRRS"
elif paperCount > scissorsCount:
# paper is most common
if rockCount > scissorsCount:
choices = "SSSPPR"
else:
choices = "SSSRRP"
else:
# scissors is most common
if rockCount > paperCount:
choices = "RRRPPS"
else:
choices = "RRRSSP"
output = random.choice(choices)