Skip to content

Instantly share code, notes, and snippets.

Created August 3, 2016 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/89082d2552de428f8386d9f8ac336a10 to your computer and use it in GitHub Desktop.
Save anonymous/89082d2552de428f8386d9f8ac336a10 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
enum Hand <πŸ‘Š βœ‹ ✌>;
multi infix:<✊>(βœ‹, πŸ‘Š) { True }
multi infix:<✊>(πŸ‘Š, ✌) { True }
multi infix:<✊>(✌ , βœ‹) { True }
multi infix:<✊>($ , $ ) { False }
my $p1 = Hand.roll;
say "Player 1 chooses: {$p1}";
my $p2 = Hand.roll;
say "Player 2 chooses: {$p2}";
say do {
when $p1 ✊ $p2 { "Player 1 wins!"}
when $p2 ✊ $p1 { "Player 2 wins!"}
default { "It's a tie!" }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment