Author | ntsp |
Submission date | 2011-06-09 08:34:45.397516 |
Rating | 5712 |
Matches played | 4221 |
Win rate | 58.97 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "": # initialize variables for the first round
moves = []
beat = "R"
output = "R"
else:
moves.append(input)
random.shuffle(moves)
beat = moves[0]
if beat == "R":
output = "P"
elif beat == "P":
output = "S"
else:
output = "R"