Author | noname |
Submission date | 2018-05-18 15:00:39.358990 |
Rating | 3863 |
Matches played | 278 |
Win rate | 37.41 |
Use rpsrunner.py to play unranked matches on your computer.
#!/usr/bin/env python
import sys
import time
cycle = {"R": "P", "P": "S", "S": "R"}
if input == "": # initialize variables for the first round
rockCount = paperCount = scissorsCount = 0
elif input == "R":
rockCount += 1
elif input == "P":
paperCount += 1
elif input == "S":
scissorsCount += 1
print rockCount, paperCount, scissorsCount
# time.sleep(.005)
if input == "":
output = cycle["R"]
else:
output = cycle[input]
if rockCount > paperCount and rockCount > scissorsCount:
output = "P"
elif paperCount > scissorsCount:
output = "S"
else:
output = "R"