Author | austin&paulette |
Submission date | 2018-03-06 02:44:50.188430 |
Rating | 4911 |
Matches played | 294 |
Win rate | 49.32 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "": # initialize variables for the first round
rockCount = 0
paperCount = 0
scissorsCount = 0
if random.choice(['A','P'])=='A':
output = random.choice(["R","P","S"]) # rock beats scissors
elif input == "R":
rockCount += 1
elif input == "P":
paperCount += 1
elif input == "S":
scissorsCount += 1
if rockCount > paperCount and rockCount > scissorsCount:
output = "P" # paper beats rock
elif paperCount > scissorsCount:
output = "S" # scissors beats paper
else:
output = random.choice(["R","P","S"]) # rock beats scissors
output = random.choice(["R","P","S"]) # rock beats scissors