This program has been disqualified.
Author | Naturel |
Submission date | 2014-01-09 01:51:47.107996 |
Rating | 5201 |
Matches played | 17 |
Win rate | 52.94 |
if input == "":
import re
opponentMoves = ""
else:
opponentMoves += input
opponentMoves = opponentMoves[-25:]
likely = {'R': 0, 'P': 0, 'S': 0}
for i in range(1, len(opponentMoves) - 1):
pattern = opponentMoves[-i:] + "."
matches = re.findall(pattern, opponentMoves)
for match in matches:
likely[match[-1]] += 1
if not matches:
break
opponent_prediction = max(likely, key=lambda m: likely[m])
if opponent_prediction == 'R':
output = 'P'
elif opponent_prediction == 'P':
output = 'S'
elif opponent_prediction == 'S':
output = 'R'