Author | tac |
Submission date | 2014-12-06 15:34:35.133502 |
Rating | 5767 |
Matches played | 523 |
Win rate | 59.85 |
Use rpsrunner.py to play unranked matches on your computer.
import random
beat = {'R':'P', 'P':'S', 'S':'R'}
output = random.choice(["R","P","S"])
if input == "":
h = ""
else:
h += input
if len(h) >= 20:
if len(h) <= 100 and h[-5:] in ['RRRRR', 'PPPPP', 'SSSSS']:
output = beat[h[-1]]
elif len(h) <= 300 and h[-6:] in ['RRRRRR', 'PPPPPP', 'SSSSSS']:
output = beat[h[-1]]
elif h[-3:] == h[-6:-3] == h[-9:-6]:
output = beat[h[-3]]