rustable2

Authorthisguy2
Submission date2014-10-12 02:32:25.890184
Rating4958
Matches played536
Win rate48.32

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

Source code:

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]]
    print hist
    return random.choice('RPS')

hist += input
output = get_move(hist)