Rock Paper Scissors

Geoffrey Challen // 2023.8.0

Let's play rock-paper-scissors! Create a method name findWinner that accepts two int arguments: the first is my pick, the second is yours. The arguments will both between 0 and 2, inclusive, and correspond in the following way to rock, paper, and scissors:

  • 0: rock
  • 1: paper
  • 2: scissors

You can learn more about this game here. However, as a brief summary: scissors beats paper, paper beats rock, and rock beats scissors. If both players pick the same value, a tie occurs and the game continues.

Based on the values passed to findWinner, if I won return "I win!", if you won return "You win!", and if the round is a tie return "Play again!".

Note that there are ways to solve this problem without checking all possible combinations, and even more clever ways that utilize modular arithmetic.