Author | Ding |
Submission date | 2017-12-14 05:57:36.412310 |
Rating | 4876 |
Matches played | 324 |
Win rate | 47.22 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
moves=""
def count_substring(str, sub):
if len(str) == 0:
return 0
if str[0:len(sub)] == (sub):
return 1 + count_substring(str[1:], sub)
else:
return 0 + count_substring(str[1:], sub)
rockcount=0
papercount=0
scissorscount=0
last_2= moves[-2:]
last_3= moves[-3:]
last_4= moves[-4:]
if rockcount > papercount and rockcount > scissorscount:
output = "P"
elif papercount > scissorscount and papercount > rockcount:
output = "S"
elif scissorscount > papercount and scissorscount > rockcount:
ouput = "R"
else:
output = random.choice(["R", "P", "S"])
moves = moves + input