scacac

Authorxsasxax
Submission date2019-06-07 17:23:12.140829
Rating4724
Matches played229
Win rate45.41

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

Source code:

import re
import random
if input == "":
    opponentbotmoves = ""
else:
    opponentbotmoves += input

opponentbotmoves = opponentbotmoves[-4:] #cosidering last 4 moves of the opponent

likely = {'R': 0, 'P': 0, 'S': 0}

for i in range(1, len(opponentbotmoves) - 1):
    pattern = opponentbotmoves[-i:] + "."
    for match in re.findall(pattern, opponentbotmoves):
        likely[match[-1]] += 1

opponentbotprediction = max(likely, key=lambda m: likely[m])

if opponentbotprediction == 'R':
    output = 'P'
elif opponentbotprediction == 'P':
    output = 'S'
elif opponentbotprediction == 'S':
    output = 'R'