Author | brad |
Submission date | 2011-05-26 20:25:44.269525 |
Rating | 2333 |
Matches played | 7012 |
Win rate | 18.23 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == '':
history = { 'R': 0, 'P': 0, 'S': 0 }
output = random.choice(['R', 'P', 'S'])
else:
history[input] += 1
c, _ = sorted((k, v) for k, v in history.items())[0]
output = { 'R': 'P', 'P': 'S', 'S': 'R' }[c]