Skip to content

Instantly share code, notes, and snippets.

import random
def player(prev_play, opponent_history=[]):
# Record opponent move
if prev_play != "":
opponent_history.append(prev_play)
# First move (no history)
if len(opponent_history) < 5:
return random.choice(["R", "P", "S"])