Author | dllu |
Submission date | 2011-05-22 01:20:12.331185 |
Rating | 4988 |
Matches played | 7329 |
Win rate | 40.33 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if not input:
lloutput = 'P'
loutput = output = 'P'
else:
if input == {'R':'P','P':'S','S':'R'}[lloutput]:
output = {'R':'S','P':'R','S':'P'}[loutput]
elif input == {'R':'S','P':'R','S':'P'}[lloutput]:
output = {'R':'R','P':'P','S':'S'}[loutput]
elif input == {'R':'R','P':'P','S':'S'}[lloutput]:
output = {'R':'P','P':'S','S':'R'}[loutput]
loutput = output
lloutput = loutput