Rock Paper Scissors: Can't beat Abbey

Hello, I have been trying to beat the Rock Paper Scissors project in the Machine Learning with Python course.

I have been able to beat all bots( by using counter-strategies for each one of them) except from Abbey, since she seems to be using a Markov Chain algorithm keeping track of the last two plays I imagined going one step further and keeping track of the three last plays should do it. I was wrong. Now I’m stuck here and I am stuck unable to continue. Any tips on how should I approach the game with Abbey?

Thank you.

Welcome @ventuura94. I beleive determining how long a Makov Chain she is using and then implementing your own which has a longer chain length is enough to beat her and pass the tests.

Let me know how you get on :+1:

Yes, that should work but may not get you over the threshold percentage. But, if you have already done counter strategies, and can work out Abbey’s Markov chain strategy, and can predict her next move, then you can use that as a counter strategy as well.

Managed to complete the challenge. At first I could not beat her because I didn’t reset the opponent history. Then I got stuck at 59.8% so I just made a longer Markov Chain and now everything is fine.
Thank you!

Is this a reasonable solution?
Counter-strategies are basically copy-paste the bots, add a counter to switch every 1000 turns and tell the model to just choose one response further (so if a bot predicts my code would do paper, I use the same predicion and tell it to do rock).

This doesn’t feel like a “good” solution. It works and can easily achieve 100%, but it’s just… well it feels like cheating xD

In the words of a local high school football coach: “If you ain’t cheatin’, you ain’t tryin’.”

But more seriously, do we rule out using a Markov chain because Abbey does? Or do we forego reading Abbey’s implementation of a Markov chain because she’s a competitor? Or, if I implement a Markov chain of the same length as Abbey and we play to a draw, how many draws should I play before I realize that if I’m always drawing her, then I know her moves, and I should use that knowledge to play a winner instead? Or, maybe my counter strategy was a scanner that watched for periodic repeats that started playing winners when it recognized the pattern. Of course I agree completely that if someone just copied the source of the other players and add the play the winner code, then they missed the fun. I also would feel remiss in my duties as a competitor if I didn’t peek at the cards when the other players let me.

But, if you really want to cheat, since you have access to all of the tooling, modules, and instrumentation available in the python interpreter, you can name your player Sanke and the bots Mantis and go full Metal Gear Solid on the other players.

1 Like

That’s only if you want to beat most of them with close to 100%. My player that could beat Abbey well enough to pass the test managed to beat all the other bots with a winrate of over 70%. But starting with counter-strategies helped me get a hint on how to apply my knowledge to this particular exercise.