Author | Joey |
Submission date | 2012-09-26 18:47:01.462903 |
Rating | 1670 |
Matches played | 750 |
Win rate | 16.13 |
Use rpsrunner.py to play unranked matches on your computer.
import random
def minus(lis,el):
res = []
for e in lis:
if e != el:
res += e
return res
if input == '':
r = 0
p = 0
s = 0
output = random.choice(['R','P','S'])
else:
if input == 'R':
r += 1
if input == 'S':
s += 1
else:
p += 1
remainders = ['R','P','S']
if r > p or r > s:
remainders = minus(remainders,['R'])
if p > r or p > s:
remainders = minus(remainders,['P'])
if s > r or s > p:
remainders = minus(remainders,['S'])
output = remainders[0]