Author | Carsten Drossel |
Submission date | 2011-06-20 12:44:42.033442 |
Rating | 2639 |
Matches played | 5007 |
Win rate | 25.84 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
history = ""
output = random.choice(["R","P","S"])
else:
history += input
tobeat = history[random.randint(0, len(input)-1)]
if tobeat == "R":
output = "P"
elif tobeat == "P":
output = "S"
elif tobeat == "S":
output = "R"