compliment_max_10

Authorcuriouscat
Submission date2012-12-21 04:36:59.741182
Rating1447
Matches played733
Win rate11.32

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

Source code:

import random
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 = "S"
elif guess == "P":
	output = "R"
else:
	output = "P"