Author | Great Driver |
Submission date | 2014-12-14 17:48:46.783664 |
Rating | 6693 |
Matches played | 563 |
Win rate | 60.04 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "": # initialize variables for the first round
r=p=s=0
elif input == "R":
r=r+1
elif input == "P":
p=p+1
elif input == "S":
s=s+1
if input == "":
output="S"
else:
choice = random.randrange(r+p+s)
if choice < r:
output="P"
elif choice < r+p:
output = "S"
else:
output = "R"