Code Golf - Rock Paper Scissors
I know this has been done on other sites before but I thought this would be a fun one to play with non-code-golfing languages.
Write the smallest program possible within the constraints:
Edit: I wish I put this in the 'Ask' section so I could choose a correct answer
Thanks, everyone, for your submissions, this was awesome.
Write a rock paper scissors program with as few characters as you can using the repl programming language of your choice (it must be on repl).
Rock Paper Scissors:
Your program must take a single input
Input will be one of these strings: 'rr' 'rp' 'rs' 'pp' 'pr' 'ps' 'ss' 'sr' 'sp'
r - rock
p - paper
s - scissors
'rp' - means player 1 chooses rock, player 2 chooses paper
'pr' - means player 1 chooses paper, player 2 chooses rock
and so on
Program will output one of the following:
D for draw
L for player 1 lose
W for player 1 win
It must be in a repl
Output must be either 'D', 'L', or 'W'
It must be able to run from the mini-repl window (in your comment/post)
Given the input, you must match the output:
input: rr output: D
input: rp output: L
input: rs output: W
input: pr output: W
input: pp output: D
input: ps output: L
input: sr output: L
input: sp output: W
input: ss output: D