SHA256

AuthorRyanC
Submission date2012-10-03 23:48:01.462985
Rating5111
Matches played735
Win rate48.71

Use rpsrunner.py to play unranked matches on your computer.

Source code:

# This one actually works
from hashlib import sha256

throws = ['R', 'P', 'S']

# Initialize state with carefully chosen constant.
if input == '':
    state = 'I win against bots that always throw the same thing!'
else:
    state = state + input

# Choose a throw deterministically based on opponent's throws so far.
output = throws[int(sha256(state).hexdigest(), 16) % len(throws)]