Rock Paper Scissors Kata

Rock Paper Scissors Kata

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, Paper beats Rock. It gets a lot more complicated when you introduce new gestures, but let's keep it simple for now.

As always, we want you to create a backend for the game that we can use to hook up to our many game clients we're going to be creating. Once again, feel free to use any front-end to test your program.


Feature 1 - Implementing the Basic Rules

We're definitely going to need a way to decide who has won and who has lost, or whether the round has ended in a draw. Using the rules provided, give us an engine for deciding this based on the player's moves.

Rock Beats Scissors

As a player
I want rock to beat scissors
So that I can play with rules I'm familiar with

  • Given I have chosen rock
    When the opponent chooses scissors
    Then I should win
  • Given I have chosen scissors
    When the opponent chooses rock
    Then they should win

Scissors Beats Paper

As a player
I want scissors to beat paper
So that I can play with rules I'm familiar with

  • Given I have chosen scissors
    When the opponent chooses paper
    Then I should win
  • Given I have chosen paper
    When the opponent chooses scissors
    Then they should win

Paper Beats Rock

As a player
I want paper to beat rock
So that I can play with rules I'm familiar with

  • Given I have chosen paper
    When the opponent chooses rock
    Then I should win
  • Given I have chosen rock
    When the opponent chooses paper
    Then they should win

Same Moves Result in Draw

As a player
I want the same moves to draw
So that I can play with rules I'm familiar with

  • Given I have chosen rock
    When the opponent chooses rock
    Then it should be a draw
  • Given I have chosen scissors
    When the opponent chooses scissors
    Then it should be a draw
  • Given I have chosen paper
    When the opponent chooses paper
    Then it should be a draw