Author | 234234 |
Submission date | 2014-10-12 02:30:39.179034 |
Rating | 4882 |
Matches played | 539 |
Win rate | 48.98 |
Use rpsrunner.py to play unranked matches on your computer.
import random
trump = {'R': 'P', 'P': 'S', 'S': 'R'}
hist = ""
def get_move(hist):
for k in range(len(hist)-1, 1, -1):
m = hist.rfind(hist[-k:], 0, -1)
if m != -1 :
return trump[hist[m+k]]
return random.choice('RPS')
hist += input
output = get_move(hist)