Author | flug |
Submission date | 2019-06-02 15:18:16.328112 |
Rating | 1934 |
Matches played | 234 |
Win rate | 20.51 |
Use rpsrunner.py to play unranked matches on your computer.
if input == "": # initialize variables for the first round
rockrockCount = paperrockCount = scissorsrockCount = 0
rockpaperCount = paperpaperCount = scissorspaperCount = 0
rockscissorsCount = paperscissorsCount = scissorsscissorsCount = 0
rockCount = paperCount = scissorsCount = 0
previnput = ""
elif input == "R":
rockCount +=1
if previnput == "R":
rockrockCount += 1
if previnput == "P":
paperrockCount += 1
if previnput == "S":
scissorsrockCount += 1
elif input == "P":
paperCount += 1
if previnput == "R":
rockpaperCount += 1
if previnput == "P":
paperpaperCount += 1
if previnput == "S":
scissorpaperCount += 1
elif input == "S":
scissorsCount += 1
if previnput == "R":
rockscissorsCount += 1
if previnput == "P":
paperscissorsCount += 1
if previnput == "S":
scissorsscissorsCount += 1
if rockCount > paperCount and rockCount > scissorsCount:
if rockrockCount > paperrockCount and rockrockCount > scissorsrockCount:
output = "P" # paper beats rock
elif paperrockCount > scissorsrockCount:
output = "S" # scissors beats paper
else:
output = "R" # rock beats scissors
elif paperCount > scissorsCount:
output = "S" # scissors beats paper
else:
output = "R" # rock beats scissors