Neil [test 3]

Authorrdococ
Submission date2015-03-28 11:57:44.402638
Rating1494
Matches played507
Win rate14.79

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

Source code:

import random
output = random.choice(["R", "P", "S"])
HISTORY_L=4
def most_common(l):
    max = 0
    maxitem = None
    for x in set(l):
        count =  l.count(x)
        if count > max:
            max = count
            maxitem = x
    return maxitem

if input == "": # initialize variables for the first round
        history=''
        for n in range(1, HISTORY_L):
                history += random.choice(['R','P','S'])

history += input

guess=most_common(history[-HISTORY_L:-1])

if guess == "R":
	output = "S"
elif guess == "P":
	output = "R"
elif guess == "S":
	output = "P"