Introspective v2

This program has been disqualified.


AuthorSteeler
Submission date2011-06-10 17:15:49.337889
Rating3690
Matches played2613
Win rate37.66

Source code:

import math
import sys

def count(total, substr):
    n = 0
    for i in range(0, len(total)):
        if total[i:].startswith(substr):
            n += 1
    return n

if input == "":
    history = ""
    magic = 3
    output = "P"
    moves = ["R","P","S"]
    counts = [0,0,0]
elif len(history) < magic:
    output = "S"
else:
    for i in [0,1,2]:
        counts[i] = count(history, history[len(history) - magic:] + moves[i])
    if counts[0] >= counts[1] and counts[0] >= counts[2]:
        output = moves[2]
    elif counts[1] >= counts[2] and counts[1] >= counts[0]:
        output = moves[0]
    else:
        output = moves[1]
history += output