; Simple textscreen version of Rock-Paper-Scissors-Lizard-Spock game ; an upgrade to Rock-Paper-Scissors as shown on The Big Bang Theory ; The letter 'K' is used for 'spock' since 'S' is the traditional 'scissors' TO PLAY.GAME GET.USER.INPUT WHILE [NOT MEMBER? :PLAYER.CHOICE (SE "Q :CHOICES)] [GET.USER.INPUT] TYPE :PLAYER.CHOICE IF EQUAL? "Q :PLAYER.CHOICE [ (PRINT) (PRINT "|You won| :WINS "|games.|) (PRINT "|You lost| :LOSSES "|games.|) (PRINT "|We tied| :TIES "|games.|) STOP ] MAKE "MY.CHOICE PICK :CHOICES TYPE "| | TYPE :MY.CHOICE TYPE "| | MAKE "GAME WORD :PLAYER.CHOICE :MY.CHOICE SWITCH :GAME [ [RR PP SS LL KK] [PRINT [|-- tie game|] SCORE "TIE] [SP] [PRINT [|-- you win -- scissors cuts paper|] SCORE "WIN] [PR] [PRINT [|-- you win -- paper covers rock|] SCORE "WIN] [RL] [PRINT [|-- you win -- rock crushes lizard|] SCORE "WIN] [LK] [PRINT [|-- you win -- lizard poisons Spock|] SCORE "WIN] [KS] [PRINT [|-- you win -- Spock smashes scissors|] SCORE "WIN] [SL] [PRINT [|-- you win -- scissors decapitates lizard|] SCORE "WIN] [LP] [PRINT [|-- you win -- lizard eats paper|] SCORE "WIN] [PK] [PRINT [|-- you win -- paper disproves Spock|] SCORE "WIN] [KR] [PRINT [|-- you win -- Spock vaporizes rock|] SCORE "WIN] [RS] [PRINT [|-- you win -- rock crushes scissors|] SCORE "WIN] [PS] [PRINT [|-- you lose -- paper cut by scissors|] SCORE "LOSS] [RP] [PRINT [|-- you lose -- rock covered by paper|] SCORE "LOSS] [LR] [PRINT [|-- you lose -- lizard crushed by rock|] SCORE "LOSS] [KL] [PRINT [|-- you lose -- Spock poisoned by lizard|] SCORE "LOSS] [SK] [PRINT [|-- you lose -- scissors smashed by Spock|] SCORE "LOSS] [LS] [PRINT [|-- you lose -- lizard decpitated by scissors|] SCORE "LOSS] [PL] [PRINT [|-- you lose -- paper eaten by lizard|] SCORE "LOSS] [KP] [PRINT [|-- you lose -- Spock disproved by paper|] SCORE "LOSS] [RK] [PRINT [|-- you lose -- rock vaporized by Spock|] SCORE "LOSS] [SR] [PRINT [|-- you lose -- scissors crushed by rock|] SCORE "LOSS] ] WAIT 2000 PLAY.GAME END TO GET.USER.INPUT DISPLAY.PROMPT MAKE "PLAYER.CHOICE UPPERCASE READCHAR END TO DISPLAY.PROMPT CT PRINT [|Rock-Paper-Scissors-Lizard-Spock Game as seen on The Big Bang Theory.|] PRINT [|Scissors cuts paper, paper covers rock, rock crushes lizard, lizard|] PRINT [|poisons Spock, Spock smashes scissors, scissors decapitates lizard,|] PRINT [|lizard eats paper, paper disproves Spock, Spock vaporizes rock, and,|] PRINT [|as it always has, rock crushes scissors. NOTE: Use 'K' for Spock.|] PRINT [|Enter R P S L K or Q to quit|] END TO SCORE :RESULT SWITCH :RESULT [ [WIN ] [MAKE "WINS 1 + :WINS] [LOSS] [MAKE "LOSSES 1 + :LOSSES] [TIE ] [MAKE "TIES 1 + :TIES] ] END TO RPSLK MAKE "WINS 0 MAKE "LOSSES 0 MAKE "TIES 0 MAKE "CHOICES [R P S L K] CLEARTEXT PLAY.GAME END ; SWITCH simulates the CASE or SWITCH statement found in other languages ; The actual CASEs are set up in the call to SWITCH. For example: ; ; SWITCH :CHOICE [ ; [1 2 3] [PRINT :CHOICE] ; [4 5 6] [FD 100] ; [7 8 9] [BK 200] ; [ELSE ] [PRINT [|No matching CASES|] ; ] ; TO SWITCH :VALUE :CASES IF EMPTY? :CASES [STOP] IF MEMBER? :VALUE FIRST :CASES [RUN FIRST BUTFIRST :CASES STOP] IF EQUAL? "ELSE FIRST FIRST :CASES [RUN FIRST BUTFIRST :CASES STOP] SWITCH :VALUE BUTFIRST BUTFIRST :CASES END RPSLK