rock-paper-scissors/RPS.py
2020-09-29 09:48:01 -05:00

11 lines
399 B
Python

# The example function below keeps track of the opponent's history and plays whatever the opponent played two plays ago. It is not a very good player so you will need to change the code to pass the challenge.
def player(prev_play, opponent_history=[]):
opponent_history.append(prev_play)
guess = "R"
if len(opponent_history) > 2:
guess = opponent_history[-2]
return guess