Author | Lefa |
Submission date | 2019-02-17 18:29:22.044824 |
Rating | 1913 |
Matches played | 256 |
Win rate | 17.97 |
Use rpsrunner.py to play unranked matches on your computer.
import random
def win(p):
if prev=="R":
return "S"
elif prev=="P":
return "R"
elif prev=="S":
return "P"
def selectgame(bfs_dfs,depth):
return win(prev)
if input=="":
bfs_dfs=random.randint(0,1)
play=random.choice(["R","P","S"])
repeat=""
else:
#prev=input()
prev=input
bfs_dfs=0
repeat=""
play=""
d=1
#print prev
if repeat=="":
d+=1
play=selectgame(bfs_dfs,d)
elif repeat==input:
winner=1
play=win(prev)
repeat=input
output= play
#print play
#intialization stage