Self-defeating

AuthorChia
Submission date2020-01-08 10:14:15.422024
Rating5204
Matches played201
Win rate53.23

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

Source code:

import random

# Initialise history with one of each choice
if input == "":
    history = list(range(3))
    
# Beat a random throw from my own history
choice = (random.choice(history) + 1) % 3

# Update history
history.append(choice)

# Convert (0, 1, 2) to (R, P, S) and output
output = "RPS"[choice]