Author | KINGKARL |
Submission date | 2015-11-03 19:18:30.636510 |
Rating | 3604 |
Matches played | 434 |
Win rate | 34.79 |
Use rpsrunner.py to play unranked matches on your computer.
import random
ans = ['R','P','S']
if input == '':
usr = ['']
com = []
rnd = 0
com.append(random.choice(ans))
else:
usr.append(input)
if com[rnd] == 'R':
if usr[rnd] == 'P':
com.append(random.choice(ans))
else:
com.append(com[rnd])
elif com[rnd] == 'P':
if usr[rnd] == 'S':
com.append(random.choice(ans))
else:
com.append(com[rnd])
elif com[rnd] == 'S':
if usr[rnd] == 'R':
com.append(random.choice(ans))
else:
com.append(com[rnd])
output = com[rnd+1]
rnd += 1