Author | Waffle |
Submission date | 2016-06-18 20:24:35.269545 |
Rating | 6033 |
Matches played | 421 |
Win rate | 60.1 |
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
r = random.randint(0,rockCount+paperCount+scissorsCount)
if r <= rockCount:
output = "P"
elif r<= rockCount+paperCount:
output = "S"
else:
output = "R"