This program has been disqualified.
Author | Cabu |
Submission date | 2012-07-31 12:56:55.190885 |
Rating | 5958 |
Matches played | 10 |
Win rate | 70.0 |
import random
beat_dict = {'R': 'P', 'P': 'S', 'S': 'R'}
if input == '':
opp_history = ''
x = -1
else:
opp_history += input
length = min (len (opp_history) - 1, 100)
while length > 0:
# Search for the last longest chain
x = opp_history[:-1].rfind (opp_history[-length:])
if x >= 0:
# If found: Pick what will be the next move and play against it
output = beat_dict[opp_history[x + length]]
break
length -= 1
if x == -1:
output = random.choice (('R', 'P', 'S'))