| Author | Spencer | 
| Submission date | 2017-10-26 08:41:56.831910 | 
| Rating | 4147 | 
| Matches played | 326 | 
| Win rate | 39.57 | 
Use rpsrunner.py to play unranked matches on your computer.
import random
from time import time
BEATS = { 'R': 'S', 'S': 'P', 'P': 'R' }
BACKWARDS = { 'S': 'R', 'P': 'S', 'R': 'P' }
OPTIONS = ['R', 'P', 'S']
player_last = []
bot_last = []
random.seed(time())
def random_play():
    rand_n = random.randint(1, 17)
    if rand_n <= 5:
        return 'R'
    elif rand_n <= 10:
        return 'S'
    else:
        return 'P' # slightly more likely
    #python 3
    #return random.choices(OPTIONS, weights = [5, 7, 5])[0]
player_last.append(input) 
output = None
# First move of game
if len(bot_last) == 0:
    # Choose random, favoring P
    output = random_play()
else:
    # If the player won, they'll stick
    if BEATS[player_last[-1]] == bot_last[-1]:
        output = BACKWARDS[player_last[-1]]
    # If bot won, choose what beats bot's last move
    else: #BEATS[bot_last[-1]] == player_last[-1]:
        output = BACKWARDS[bot_last[-1]]
    # If it ties, play what beats the last play
    #else: see last condition
bot_last.append(output)