Freq

AuthorFreqAuthor
Submission date2019-01-12 01:14:21.389806
Rating5494
Matches played247
Win rate56.68

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

Source code:

from collections import defaultdict
import random

if input == "":
	output = random.choice("RPS")
	my = output
	their = ""
	allcounts = defaultdict(lambda: defaultdict(int))
else:
	their += input
	if len(their) > 1:
		allcounts[my[-2]+their[-2]][their[-1]] += 1
		counts = allcounts[my[-1]+their[-1]]
		if counts["R"] > counts["P"] and counts["R"] > counts["S"]:
			output = "P"
		elif counts["P"] > counts["S"]:
			output = "S"
		else:
			output = "R"
	else:
		output = "PSR"[["R", "P", "S"].index(input)]
	my += output