Author | sands of time |
Submission date | 2016-10-08 03:37:59.836169 |
Rating | 3594 |
Matches played | 413 |
Win rate | 34.62 |
Use rpsrunner.py to play unranked matches on your computer.
if input == "": # initialize variables for the first round
rockCount = paperCount = scissorsCount = loseCount = winCount = tieCount = 0
output = "R"
elif input == "R":
tieCount = (tieCount + 1) if (last == "R") else tieCount
winCount = (winCount + 1) if (last == "P") else winCount
loseCount = (loseCount + 1) if (last == "S") else loseCount
rockCount += 1
elif input == "P":
tieCount = (tieCount + 1) if (last == "P") else tieCount
winCount = (winCount + 1) if (last == "S") else winCount
loseCount = (loseCount + 1) if (last == "R") else loseCount
paperCount += 1
elif input == "S":
tieCount = (tieCount + 1) if (last == "S") else tieCount
winCount = (winCount + 1) if (last == "R") else winCount
loseCount = (loseCount + 1) if (last == "P") else loseCount
scissorsCount += 1
#if rockCount > paperCount and rockCount > scissorsCount:
# output = "P" # paper beats rock
#elif paperCount > scissorsCount:
# output = "S" # scissors beats paper
#else:
# output = "R" # rock beats scissors
if tieCount > 1.2*loseCount and tieCount > 1.2*winCount:
if output == "R":
output = "P"
elif output == "P":
output = "S"
else:
output = "R"
elif loseCount > 1.2*winCount:
if output == "R":
output = "S"
elif output == "P":
output = "R"
else:
output = "P"
last=output