Author | ScienceMentorsTest |
Submission date | 2019-07-25 06:25:17.244822 |
Rating | 4767 |
Matches played | 230 |
Win rate | 46.09 |
Use rpsrunner.py to play unranked matches on your computer.
import random
choices = ["R", "P", "S"]
winningPairs = {"R": "S", "P": "R", "S": "P"}
botPrevInput = ""
if input is "":
botPrevInput = choices[random.randint(0, 2)]
else:
if input == botPrevInput or botPrevInput == "":
botPrevInput = choices[random.randint(0, 2)]
elif winningPairs[input] == botPrevInput:
botPrevInput = winningPairs[botPrevInput]
elif winningPairs[botPrevInput] == input:
botPrevInput = botPrevInput #unnecessary
output = botPrevInput