I am using “win-stay,lose_shift” strategy to complete the project but the winning percentage is lower than it should be. Can someone tell me what I’m doing wrong or what should I change.
def player(prev_play,my_history = []):
winning_set = {
"R":"P",
"P":"S",
"S":"R"
}
if len(my_history)>1:
if (winning_set[my_history[-1]]==prev_play):
guess = winning_set[prev_play]
else:
guess = winning_set[my_history[-1]]
else:
guess = "P"
my_history.append(guess)
return guess
Here is a link to challenge.