HP Forums

Full Version: (50G) RPSSL (Rock Paper Scissors Spock Lizard)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Everybody knows the ancient game of "Rock, Paper, Scissors" which even has its own Wikipedia page. Almost as well known is the much newer 5-weapon version called "Rock Paper Scissors Spock Lizard" (aka RPSSL), invented by Sam Kass and Karen Bryla. The simple rules are on its official website.

Here's a surprisingly short HP 50g program that plays RPSSL, user against calculator, complete with the official winning messages!

Note: "SCISSORS DECAPITATE LIZARD" has been changed to "SCISSORS STAB LIZARD" to fit the display.

INSTRUCTIONS:
(1) Run RPSSL. See "PICK ONE!" at the top of the screen. The soft menu keys are now labeled ROCK, PAPER, SCISSORS, SPOCK, LIZARD, and EXIT.
(2) Choose a weapon by pressing it. The calculator immediately chooses its weapon (without looking at yours!) and displays the result of the match, e.g. "YOU: SPOCK. ME: LIZARD. LIZARD POISONS SPOCK. I WIN!"
(3) Repeat step 2 until you are sufficiently entertained.
(4) Press the EXIT soft menu key to exit and return the menu to its previous contents.

Code:
%%HP: T(3)A(R)F(.);
\<< { "ROCK" "PAPER" "SCISSORS" "SPOCK" "LIZARD" } DUP "EXIT" + TMENU CLLCD "PICK ONE!" 1 DISP
WHILE -1 WAIT 10.1 - DUP 5 \<=
REPEAT DUP2 GET "YOU: " SWAP + 1 DISP RAND 5 * CEIL 3 PICK OVER GET
  " ME: " SWAP + 2 DISP DUP2 SAME { DROP2 "TIE!" "" 4 DISP }
  { DUP2 - 5 MOD 2 MOD 4 PICK PICK3 GET 5 PICK 5 PICK GET
  IF PICK3 THEN SWAP END 5 ROLL 5 ROLL MIN LASTARG MAX OVER -
  { { "COVERS" "BREAKS" "VAPORIZES" "CRUSHES" } { "CUT" "DISPROVES" "EATS" } { "SMASHES" "STAB" } { "POISONS" } }
  ROT GET SWAP GET " " + SWAP + " " SWAP + + 4 DISP "YOU" "I" IFTE " WIN!" + } IFTE 6 DISP
END DROP2 0 TMENU \>>

BYTES without name: 546.0 #3BA8h

Note: Originally posted on comp.sys.hp48 on 12 March 1998 for the HP 48.
Reference URL's