Author | TidyMaze |
Submission date | 2018-08-26 15:12:50.778435 |
Rating | 4307 |
Matches played | 286 |
Win rate | 39.51 |
Use rpsrunner.py to play unranked matches on your computer.
def beating(symb):
return {
"R": "P",
"P": "S",
"S": "R"
}.get(symb)
count = {
"R": 0,
"P": 0,
"S": 0
}
if input == "": # initialize variables for the first round
rockCount = paperCount = scissorsCount = 0
else:
count[input] += 1
if count["R"] > count["P"] and count["R"] > count["S"]:
output = beating("R")
elif count["P"] > count["S"]:
output = beating("P")
else:
output = beating("S")