Author | hawk |
Submission date | 2011-06-09 09:37:04.712750 |
Rating | 6033 |
Matches played | 5610 |
Win rate | 58.54 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
rc, pc, sc = 1, 1, 1
elif input == "R":
rc += 1
elif input == "P":
pc += 1
elif input == "S":
sc += 1
tc = rc + pc + sc
r = random.randint(1, tc)
if r <= rc:
output = "P"
elif r <= rc + pc:
output = "S"
else:
output = "R"