In this lesson, we will create a game of “Rock, Paper, Scissors”.

After implementing the simple logic of the game, we will primarily ensure that:

  1. The choices of the players are not visible to each other.
  2. The game becomes a tournament (so the players can play the game multiple times).

So, let’s get to it!

Rules of the game

There will be 2 players, and each player will choose either of the 3 symbols listed below:

  • ‘s’ represents scissors.
  • ‘p’ represents paper.
  • ‘r’ represents rock.

The rules are as follows:

  1. The scissors can cut the paper.
  2. The rock can break the scissors.
  3. The paper can cover the rock.

Write a program that implements the logic of the “Rock, Paper, Scissors” game. In this game, two players individually select “rock,” “paper,” or “scissors" by typing r for rock, p for paper, or s for scissors. The winner is the one whose choice dominates the other.

Get hands-on with 1200+ tech skills courses.