Author | pmc |
Submission date | 2011-06-09 04:19:00.250145 |
Rating | 1838 |
Matches played | 5605 |
Win rate | 17.18 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == '':
throws = ''
else:
throws += input
len_throws = len(throws)
x = throws.replace('R', '')
num_r = len_throws - len(x)
x = throws.replace('P', '')
num_s = len(x)
num_p = len_throws - num_r - num_s
options = [(num_r, random.random(), 'R'), (num_p, random.random(), 'P'), (num_s, random.random(), 'S')]
options.sort()
output = options[-1][2]
throws += output