Author | Ahri Fox |
Submission date | 2018-01-02 09:23:31.733880 |
Rating | 3118 |
Matches played | 310 |
Win rate | 32.58 |
Use rpsrunner.py to play unranked matches on your computer.
import random
rps = ["R", "P", "S"]
lastOutput="R"
if input == "":
lastOutput = random.choice(rps)
output=lastOutput
else:
if input == lastOutput:
lastOutput = random.choice(rps)
output = lastOutput
else:
if random.randint(0,4)<2:
lastOutput=input
output=input
elif random.randint(0,1)==0:
rpsTmp = ["R", "P", "S"]
rpsTmp.remove(input)
rpsTmp.remove(lastOutput)
lastOutput = random.choice(rpsTmp)
output = lastOutput
else:
lastOutput = random.choice(rps)
output = lastOutput