50cent3

Authorsands of time
Submission date2016-10-08 03:37:59.836169
Rating3594
Matches played413
Win rate34.62

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

Source code:

if input == "": # initialize variables for the first round
	rockCount = paperCount = scissorsCount = loseCount = winCount = tieCount = 0
	output = "R"
elif input == "R":
	tieCount = (tieCount + 1) if (last == "R") else tieCount
	winCount = (winCount + 1) if (last == "P") else winCount
	loseCount = (loseCount + 1) if (last == "S") else loseCount
	rockCount += 1
elif input == "P":
	tieCount = (tieCount + 1) if (last == "P") else tieCount
	winCount = (winCount + 1) if (last == "S") else winCount
	loseCount = (loseCount + 1) if (last == "R") else loseCount
	paperCount += 1
elif input == "S":
	tieCount = (tieCount + 1) if (last == "S") else tieCount
	winCount = (winCount + 1) if (last == "R") else winCount
	loseCount = (loseCount + 1) if (last == "P") else loseCount
	scissorsCount += 1

#if rockCount > paperCount and rockCount > scissorsCount:
#	output = "P" # paper beats rock
#elif paperCount > scissorsCount:
#	output = "S" # scissors beats paper
#else:
#	output = "R" # rock beats scissors
	
if tieCount > 1.2*loseCount and tieCount > 1.2*winCount:
	if output == "R":
		output = "P"
	elif output == "P":
		output = "S"
	else:
		output = "R"
elif loseCount > 1.2*winCount:
	if output == "R":
		output = "S"
	elif output == "P":
		output = "R"
	else:
		output = "P"
	
last=output