PHP, 39 bytes
Shorter md5
variants by Christoph and Benoit Esnard.
<?=[Lizard,Spock,Rock][md5(y.$argn)%3];
Try it online!
<?=[Spock,Rock,Lizard][md5($argn.m)%7];
Try it online!
PHP, 40 bytes
<?=[Rock,Spock,Lizard][md5($argn)[5]%3];
Try it online!
Takes sixth character of md5 of input, which gives unique number of 1
for "Rock" and "Scissors", unique number of 2
for "Spock" and "Paper" and unique number of 9
for "Lizard". A mod 3 on those numbers and we have 0
or 1
or 2
indexes.
| Input | MD5 | 6th char | %3 | Output |
|----------|----------------------------------|----------|----|--------|
| Rock | 4cfbb125e9878528bab91d12421134d8 | 1 | 1 | Spock |
| Spock | 5769c28299713c949cd59d5469e40ace | 2 | 2 | Lizard |
| Paper | d0a662a5235ecde30739fe50cf0de830 | 2 | 2 | Lizard |
| Lizard | 2f7569e00c4d97aef5f2c2b3a4d2213f | 9 | 0 | Rock |
| Scissors | 28204140cee6e34a9843b64e5a490b08 | 1 | 1 | Spock |
PHP, 40 bytes
Alternative 40 bytes, port of Jo King's answer.
<?=[Spock,Lizard,Rock][strlen($argn)%4];
Try it online!
PHP, 41 bytes
This is based on 79037662's answer.
<?=[Lizard,Rock,Paper][ord($argn[-1])%3];
Try it online!
PHP (7.4), 42 bytes
Uses fifth and sixth characters of input to get one of 0, 1 or 2.
fn($s)=>[Rock,Lizard,Paper][!$s[5]+!$s[4]]
Try it online!
PHP, 43 bytes
Uses CRC32 of input and mod to get 0, 1 or 2.
<?=[Rock,Lizard,Paper][crc32($argn)%866%3];
Try it online!
PHP, 43 bytes
Uses second to the last character of input ("Rock" and "Spock" = "c", "Paper" = "e", "Lizard" and "Scissors" = "r").
<?=[c=>Paper,e=>Lizard,r=>Rock][$argn[-2]];
Try it online!
S
have no outputs in common... \$\endgroup\$