donald

Authortrump
Submission date2014-10-12 02:57:24.692033
Rating7237
Matches played600
Win rate70.5

Use rpsrunner.py to play unranked matches on your computer.

Source code:

import random

def get_move(hist):
    n = min(20, len(hist)-1)
    for k in range(n, 1, -1):
        m = hist.rfind(hist[-k:], 0, -1)
        if m != -1 :
            return trump[hist[m+k]]
    return random.choice('RPS')

if input == "":
    trump = {'R': 'P', 'P': 'S', 'S': 'R'}
    hist = ''
    output =  random.choice('RPS')
else:
    hist += input
    output = get_move(hist)