WinStayLoseSwitch

AuthorScienceMentorsTest
Submission date2019-07-25 06:25:17.244822
Rating4767
Matches played230
Win rate46.09

Use rpsrunner.py to play unranked matches on your computer.

Source code:

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