Neil (Test 2)

Authorrdococ
Submission date2015-03-28 11:56:53.636385
Rating2411
Matches played482
Win rate21.99

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

Source code:

import random
output = random.choice(["R", "P", "S"])
HISTORY_L=2
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"