Author | KINGKARL |
Submission date | 2015-11-03 19:05:09.318015 |
Rating | 3213 |
Matches played | 472 |
Win rate | 30.51 |
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 rnd >= 1:
if com[rnd-1] == 'R':
if usr[rnd] == 'P':
com.append(random.choice(ans))
else:
com.append(com[rnd-1])
elif com[rnd-1] == 'P':
if usr[rnd] == 'S':
com.append(random.choice(ans))
else:
com.append(com[rnd-1])
else:
if usr[rnd] == 'R':
com.append(random.choice(ans))
else:
com.append(com[rnd-1])
output = com[rnd]
rnd += 1