Machine Learning Project - Rock Paper Scissors - Unusual Behavior

I’m working on the Rock-Paper-Scissors project in the Python Machine Learning certification. My project is here:

Project
[edited, screwed up the link the first time]

Here’s my issue:
If I go into the main.py file and uncomment one opponent at a time (it is currently set to only play abbey), my code beats each player individually. However, if I uncomment all four players or run the unit tests through the test module, I at most beat two of the four players.

My player observes the first few turns and uses those turns to decide on a strategy. It seems like what’s happening is that my player continues using the same strategy it uses against the first player it plays on the next three, which would explain why it can beat any player individually but not when it plays them consecutively. But I can’t figure out why it is doing that, or how to reset opponent_history after each match. Any ideas?

Thanks!

Well, it depends on how dirty you want to play.

I think it’s possible to find one method to beat them all, or at least the three easy ones. There is some good, accessible reading on RPS strategy and bots if you google.

But, if you look at the tests, you can see that each player plays 1000 times. So you could count the games and know when to change strategies. It’s even possible for your player to know who it’s playing (regardless of the order of tests), and act accordingly (i.e. playing the exact strategy to beat the opponent because you can read their code…).

Good luck.