Introspective v1

This program has been disqualified.


AuthorSteeler
Submission date2011-06-10 17:02:18.403684
Rating3779
Matches played2238
Win rate36.01

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 = 4
    output = "R"
    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[0]
    elif counts[1] <= counts[2] and counts[1] <= counts[0]:
        output = moves[1]
    else:
        output = moves[2]
history += output