Skip to content

ctesta01/RPSLS

Repository files navigation

Rock Paper Scissors Lizard Spock πŸͺ¨πŸ“βœ‚οΈπŸ¦ŽπŸ––

Intro

A friendly R package for simulating rock-paper-scissors-lizard-spock games!

# To Install
devtools::install_github("ctesta01/RPSLS")

Try out the app!

The app is live on https://ctesta.shinyapps.io/RPSLS/ πŸŒ±πŸŒπŸŽ‰

Explanation

The Rock, Paper, Scissors, Lizard, Spock game is a variant of Rock, Paper, Scissors game invented by Sam Kass and Karen Bryla with Spock signified using the Star Trek Vulcan salute, and lizard sometimes shown in diagrams by forming the hand into a sock-puppet-like mouth 1. The following diagram from Wikimedia2 explains how each game is resolved. See the output of explain_the_game() below for the logic behind the diagram.

A resolution diagram of the game Rock, Paper, Scissors, Lizard, Spock

library(RPSLS)
explain_the_game()
## Scissors βœ‚οΈοΈ cuts Paper πŸ“
## Paper πŸ“ covers Rock πŸͺ¨
## Rock πŸͺ¨ crushes Lizard 🦎
## Lizard 🦎 poisons Spock πŸ––
## Spock πŸ–– smashes Scissors βœ‚οΈοΈ
## Scissors βœ‚οΈ decapitates Lizard 🦎
## Lizard 🦎 eats Paper πŸ“
## Paper πŸ“ disproves Spock πŸ––
## Spock πŸ–– vaporizes Rock πŸͺ¨
## (and as it always has) Rock πŸͺ¨ crushes Scissors βœ‚οΈ

Sampling the Elements

sample_rpsls()
## You got Paper πŸ“
sample_rpsls(2)
## Your samples:
## Sample 1: Scissors βœ‚οΈ
## Sample 2: Lizard 🦎

Playing a Game

Two players can use the sample_rpsls_pair function to simulate a single-game between two people. The result can be that player 1 wins, player 2 wins, or they tie.

sample_rpsls_pair()
## Player 1 chooses: Paper πŸ“
## Player 2 chooses: Rock πŸͺ¨
## Player 1 wins!

Tournaments

The app can be run after installing the package, loading it, and calling RPSLS::app().

Watch the explanation video on YouTube:

Explanation on YouTube

Use the builtin app to run tournaments of RPSLS

Links

Footnotes

  1. Rock, Paper Scissors. https://en.wikipedia.org/wiki/Rock_paper_scissors ↩

  2. A resolution diagram of the game Rock, Paper, Scissors, Lizard, Spock. https://en.wikipedia.org/wiki/File:Pierre_ciseaux_feuille_l%C3%A9zard_spock_aligned.svg ↩