Author | Kia Kroas |
Submission date | 2011-05-21 11:21:06.108032 |
Rating | 3568 |
Matches played | 7110 |
Win rate | 32.14 |
Use rpsrunner.py to play unranked matches on your computer.
import random
move = random.randint(0, 27)
choices = ["P", "R", "S", "P", "S", "R", "P", "R", "S", "P", "P", "P", "P", "P", "S", "P", "P", "P", "S", "P", "R", "S", "S", "S", "S", "P", "P", "R"]
if input == "":
rock = paper = scissor = 0
if input == "R":
rock += 1
output = "P"
elif input == "P":
paper += 1
output = "S"
elif input == "S":
scissor += 1
output = "R"
else:
output = 'P'
if rock > 0 and paper > 0 and scissor > 0:
output = choices[move]