Test_00003

AuthorJacob
Submission date2020-02-01 02:23:47.729155
Rating3308
Matches played201
Win rate31.84

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

Source code:

import random

if input == "":
    opponentMoves = []
else:
    opponentMoves.append(input)

length = len(opponentMoves)

endingSize = min(length - 1, 5)

output = None

for k in range(0, endingSize):
    endOfList = opponentMoves[length - endingSize + k:]

    for i in range(0, length - 1 - endingSize):
        for j in range(endingSize, 0, -1):
            if opponentMoves[i:i + j] == endOfList:
                output = opponentMoves[i + j]
                break
        else:
            continue
        break
    else:
        continue
    break

if output == None:
    output = random.choice(["R", "P", "S"])