Author | FreqAuthor |
Submission date | 2019-03-08 02:44:49.855900 |
Rating | 7133 |
Matches played | 232 |
Win rate | 71.98 |
Use rpsrunner.py to play unranked matches on your computer.
from collections import defaultdict
import random
if input == "":
output = random.choice("RPS")
hist = output.lower()
else:
hist += input
output = random.choice("RPS")
if random.random() > .9:
for D in range(min(len(hist)//2, 100) - 1, 0, -1):
i = hist[:-2].rfind(hist[-2*D:])
if i != -1:
output = "PSR"[["R", "P", "S"].index(hist[i+2*D+1])]
break
hist += output.lower()