Elixir Rock Paper Scissors

elixirgolf bio photo By elixirgolf Comment


Recreate the classic “Rock, Paper, Scissors” game in Elixir. The mechanics of the game are described below, or for more details see the Wikipedia link in our resources section.

r = rock
p = paper
s = scissors
rock: wins to scissors, loses with paper, a tie with rock.
paper: wins to rock, loses with scissors, a tie with paper.
scissors: wins to paper, loses with rock, a tie with scissors.


  • The user will input their choice as a String of 3 characters e.g. "rps"
  • The program will then output as a String of 3 characters "spr" and a result e.g. "Draw", "Win", "Lose"
  • The program will choose it’s response output randomly
  • Each individual input character will always output one of the three possibilites
  • If the user enters blank or any other character, then the program simply returns
  • The program should not be influenced by the user’s input, i.e. it should make it’s choice at random

For example:

iex> --enter your code here--

The solution that completes this puzzle with the shortest number of characters wins.

Submit your solution

Please submit your solution as a comment on the Github issue below, along with your Twitter handle (we will use this to link back to you if your solution is successful).



--- your name here ---

Honourable mentions


comments powered by Disqus