Author | dedekind |
Submission date | 2019-10-14 17:42:09.832363 |
Rating | 5049 |
Matches played | 209 |
Win rate | 45.45 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
afterR = [0,0,0]
afterP = [0,0,0]
afterS = [0,0,0]
prev = ""
picks = ["R","P","S"]
output = random.choice(picks)
rpsDictionary = {"R":0, "P":1,"S":2}
def beat(choise):
if (choise == 0):
return "P"
elif (choise == 1):
return "S"
else:
return "R"
if (prev == ""):
output = random.choice(picks)
elif (prev == "R"):
afterR[rpsDictionary.get(input)] += 1
output = beat(afterR.index(max(afterR)))
elif (prev == "P"):
afterP[rpsDictionary.get(input)] += 1
output = beat(afterP.index(max(afterP)))
elif (prev == "S"):
afterS[rpsDictionary.get(input)] += 1
output = beat(afterS.index(max(afterS)))
prev = input