hackathon

Authorjmc
Submission date2020-01-23 16:55:19.233065
Rating1988
Matches played202
Win rate19.8

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

Source code:

import random

if input == "":
    round = 1
    firstMove = random.choice(["R", "P", "S"])
    opp_history = ""
    my_history = ""
    beatby = {}
    beatby["R"] = "P"
    beatby["P"] = "S"
    beatby["S"] = "R"

opp_history += input

if round < 7:
    output = firstMove
else:
    pattern = opp_history[-6:]
    if pattern[-6:-3] == pattern[-3:]:
        output = beatby[pattern[0]]
    else:
        if pattern[-2] == pattern[-1]:
            output = pattern[-1]
        else:
            if pattern[-4:-2] == pattern[-2:]:
                output = beatby[pattern[-2]]
            else:
                if round % 2 == 0:
                    output = firstMove
                else:
                    output = pattern[-3]

my_history += output