Author | kyle morrison |
Submission date | 2011-06-10 07:58:13.828876 |
Rating | 6027 |
Matches played | 5179 |
Win rate | 62.68 |
Use rpsrunner.py to play unranked matches on your computer.
import random
moves = {'R': 'P', 'P': 'S', 'S': 'R'}
if not input:
i = 0
history = ''
my_moves = ''
things = []
output = random.choice(moves.keys())
else:
i += 1
history += input
my_moves += output
things += i*list(input)
things += i*list(moves[output])
their_move = random.choice(things)
output = moves[their_move]