Resources‎ > ‎Programming‎ > ‎Object-Oriented Design‎ > ‎OO Tutorial‎ > ‎

Lesson 7

Your task is to model Rock-Paper-Scissors (RPS) game. The RPS game require at least two players. There is no limit on the number of players. All player show their hand on the count of three. The possible hands are:

  • Rock : a clenched fist,
  • Paper : an open hand,
  • Scissors : two fingers extended and separated.

The objective is to select a hand which defeats that of other players. Hands are resolved as:

  • Rock blunts or breaks scissors: that is, rock defeats scissors.
  • Paper covers, sands or captures rock: paper defeats rock.
  • Scissors cut paper: scissors defeats paper.

When one of the following conditions is met, the game ends in draw:

  • all Rock, Paper and Scissors hands are presented, or
  • only one kind (either Rock, Paper or Scissors) is presented.
Subpages (1): Sample Solutions