GH avatar Bite 160. 15-way Rock Paper Scissors

In this Bite you are going to write a 15-way Rock Paper Scissors game (this challenge first appeared as part of our 100 Days of Code in Python course).

picture of who beats who in this 15-way version of rock paper scissors


The way you read this graphic is if an arrow points from one item to another, that pointed-to item is defeated. For example:

  • Paper defeats rock (paper points to rock)
  • Devil defeats human (devil points to human)

It turns out to be error prone and generally very unfun to work this out from the graphic. So we created a csv score sheet representing these relationships.

Complete the get_winner function following the docstring. We recommend parsing it into a dictionary/mapping of players -> beats whom (key, value) pairs (helper function _create_defeat_mapping). This will make it easier to determine the winner given any pair of (player1, player2) pairs.

The tests (see TESTS tab) will verify valid input to get_winner, all Tie scenarios and (more interestingly) all 105 outcomes using the original RPS-15 speak.

Good luck and have fun!

16 out of 16 users completed this Bite.
Will you be Pythonista #17 to crack this Bite?
It takes an average of ~74 minutes to solve this Bite (submissions 5-240 min).
Pythonistas rate this Bite 3.5 on a 1-10 difficulty scale.
» You can do it! 😌

Buy Now Login and get coding
We use Python 3.7