lastMoveTracker

AuthorSaheb
Submission date2014-10-12 12:07:25.808317
Rating4331
Matches played546
Win rate42.49

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

Source code:

if input == "": # initialize variables for the first round
        lastMove = ""
elif input == "R":
        lastMove = "R"
elif input == "P":
        lastMove = "P"
elif input == "S":
        lastMove = "S"

if lastMove == "R":
	output = "P" # paper beats rock
elif lastMove == "P":
	output = "S" # scissors beats paper
else:
	output = "R" # rock beats scissors