Author | dllu |
Submission date | 2011-05-22 03:03:44.825882 |
Rating | 3357 |
Matches played | 7427 |
Win rate | 29.23 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if not input:
lloutput = 'P'
loutput = output = 'P'
num = 0;
else:
if num<3:
output = 'P'
elif num%5==0:
output = random.choice(['R','P','P','P','S'])
elif (num+1)%5:
output = random.choice(['R','P','S','S','S'])
elif (num+2)%5:
output = random.choice(['R','R','R','P','S'])
elif 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]
lloutput = loutput
loutput = output
num+=1