Author | Daniel |
Submission date | 2013-10-02 17:28:25.357027 |
Rating | 4541 |
Matches played | 621 |
Win rate | 44.44 |
Use rpsrunner.py to play unranked matches on your computer.
if not input:
from random import choice
output = choice(list('RPS'))
last = ''
else:
if last == input:
choices = {'R':'P','P':'S','S':'R'}
output = choices[input]
else:
choices = {'PR':'P','PS':'S','RS':'R'}
key = ''.join(sorted('RPS'.replace(input,'')))
last = input
output = choices[key]