Rock Paper Scissors


Rock Paper Scissors is a game involving two players making pre-defined hand gestures at each other. The gesture that each player uses is played against the other, with a winner being decided based on the rules being used.

The three gestures used in base Rock Paper Scissors are... well... rock, paper, and scissors. The way these are scored is as such: Rock beats Scissors, Scissors beats Paper, and Paper beats Rock. It gets a lot more complicated when you introduce new gestures, but let's keep it simple for now.

Now create a backend for the game that we can use to hook up to our many game clients we're going to be creating.

Test Cases

Player Move Opponent Move Result
Paper Scissors Player Loses
Paper Paper Tie
Rock Scissors Player Wins
Rock Paper Player Loses
Rock Rock Tie
Scissors Paper Player Wins
Scissors Rock Player Loses
Scissors Scissors Tie

Bonus

Extend the game engine to include the rules for Rock, Paper, Scissors and Spock.
The new moves to include are:

  • Spock smashes Scissor
  • Paper disproves Spock
  • Spock vaporizes Rock
After implementing the additional rules make sure your code has no if statements.