A simple Rock, Paper, Scissors game

Rock, Paper, Scissors
Image by OpenClipart-Vectors from Pixabay

One of the easiest games to program is Rock, Paper, Scissors. All you are doing is a simple comparison, but programming it so the computer player can win more games than the player is not quite so easy.

The easiest strategy is always guess paper as Rock is apparently the most often chosen. That might work for the first couple of games but after that… A better strategy is count what the player plays each time to try and detect a bias. Guess randomly but make the %age of guesses favour the move that defeats the players most common move. If the player pays paper 50% of the time, guess scissors 50% of the time.

Then there’s variations on this, try and analyse past moves to give an edge. That could get quite complicated. You have to program it for pattern recognition. If the player favours scissors after losing with rock etc.

Here is a simple implementation of RPS in C.

 

Leave a Reply

Your email address will not be published. Required fields are marked *