Author | Jorge |
Submission date | 2011-07-06 18:25:05.238488 |
Rating | 3780 |
Matches played | 4502 |
Win rate | 36.18 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
plays = {"R": [],
"P": [],
"S": []}
beats = {"R": "S","P": "R","S": "P"}
output = random.choice(["R","P","S"])
else:
plays[mylast].append(input)
try:
output = random.choice(plays[mylast])
except IndexError:
output = random.choice(["R","P","S"])
mylast = output