Author | Daniel |
Submission date | 2013-10-02 17:24:18.164380 |
Rating | 1830 |
Matches played | 628 |
Win rate | 20.22 |
Use rpsrunner.py to play unranked matches on your computer.
input = 'S'
try:
last
except:
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]
print output