joseph_variation_17893

Authorjoseph
Submission date2018-03-08 19:59:35.606320
Rating4112
Matches played316
Win rate43.99

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

Source code:

import random

if input == "": # initialize variables for the first round
	last = " "
	last2 = " "
	last3 = " "
elif input == "R":
	last3 = last2
	last2 = last
	last = "R"
elif input == "P":
	last3 = last2
	last2 = last
	last = "P"
elif input == "S":
	last3 = last2
	last2 = last
	last = "S"
	
if last == "R" and last2 == "R":
	output = "P"
elif last == "P" and last2 == "P":
	output = "S"
elif last == "S" and last2 == "S":
	output = "R"
else:
	output = random.choice(["R","P","S"]) # rock beats scissors