Neil: fixed compliment max

Authorrdococ
Submission date2015-03-28 11:55:08.134870
Rating4193
Matches played517
Win rate40.23

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

Source code:

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