Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 constant rock
- 2 constant paper
- 3 constant scissors
- 4 constant lizard
- 5 constant spock
- : test-rock dup scissors = if s" rock crushes scissors" else lizard = if s" rock crushes lizard" else 0 then then ;
- : test-paper dup rock = if s" paper covers rock" else spock = if s" paper disproves spock" else 0 then then ;
- : test-scissors dup lizard = if s" scissors decapitates lizard" else paper = if s" scissors cuts paper" else 0 then then ;
- : test-lizard dup paper = if s" lizard eats paper" else spock = if s" lizard poisons spock" else 0 then then ;
- : test-spock dup rock = if s" spock vaporizes rock" else scissors = if s" spock smashes scissors" else 0 then then ;
- : test dup rock = if drop test-rock else dup paper = if drop test-paper else dup scissors = if drop test-scissors else dup lizard = if drop test-lizard else spock = if test-spock then then then then then ;
- : play 2dup = if ." Tie!" else 2dup test dup 0 = if drop swap test ." Player 1 wins: " type else ." Player 2 wins: " type 2drop then then ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement