Code Golf - Rock Paper Scissors
mwilki7

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.

Code Golf:

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.

Objective:

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

Submission format:

The number of bytes used (you can find this by pasting your code in https://mothereff.in/byte-counter )
Your repl
See my example in the comments @mwilki7

Rules:

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

Exceptions:

HTML5 repls: code in html won't count towards byte count (unless you put your javascript in a <script> tag)

You are viewing a single comment. View All
SilentShadowBla

nice!