Author | Marco |
Submission date | 2019-02-05 20:42:06.426991 |
Rating | 1607 |
Matches played | 250 |
Win rate | 14.8 |
Use rpsrunner.py to play unranked matches on your computer.
import random
class RPS:
previousOut = "R"
previousWin = "R"
def calculateWin(x,y):
if x == y:
return "D"
if x == "R" and y == "S" :
return "L"
if x == "S" and y == "P" :
return "L"
if x == "P" and y == "R" :
return "L"
if y == "R" and x == "S" :
return "W"
if y == "S" and x == "P" :
return "W"
if y == "P" and x == "R" :
return "W"
if input == "" :
RPS.previousOut = random.choice(["R","P","S"])
output = RPS.previousWin
else:
RPS.previousOut = "R"
output = RPS.previousOut