Author | RyanC |
Submission date | 2012-10-04 01:34:39.822462 |
Rating | 4597 |
Matches played | 762 |
Win rate | 47.38 |
Use rpsrunner.py to play unranked matches on your computer.
from hashlib import sha256
throws = ['R', 'P', 'S']
beat_throw = { 'R' : 'P', 'P' : 'S', 'S' : 'R' }
# This claim isn't true for SHA256-Prime :-(
if input == '':
state = 'I win against bots that always throw the same thing!'
else:
state = state + output
sha256_output = throws[int(sha256(state).hexdigest(), 16) % len(throws)]
# Output throw that beats SHA256
output = beat_throw[sha256_output]