Inffreq

AuthorFreqAuthor
Submission date2019-01-12 04:31:24.053346
Rating7479
Matches played265
Win rate75.47

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

Source code:

from collections import defaultdict
import random
def highest(S, sub):
    i = S[::-1].find(sub[::-1])
    if i != -1:
        return len(S) - len(sub) - i
    else:
        return -1
if input == "":
	output = random.choice("RPS")
	hist = output.lower()
else:
	hist += input
	for D in range(min(len(hist)//2, 100) - 1, 0, -1):
		i = highest(hist[:-2], hist[-2*D:])
		if i != -1:
			output = "PSR"[["R", "P", "S"].index(hist[i+2*D+1])]
			break
	else:
		output = random.choice("RPS")
	hist += output.lower()