Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created August 3, 2016 16:10
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 zoffixznet/cc38622703091d026be0bb1fa4fd20a2 to your computer and use it in GitHub Desktop.
Save zoffixznet/cc38622703091d026be0bb1fa4fd20a2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
sub term:<πŸ‘Š> { 'πŸ‘Š' }
sub term:<βœ‹> { 'βœ‹' }
sub term:<✌> { '✌' }
multi infix:<✊>('βœ‹', 'πŸ‘Š') { True }
multi infix:<✊>('πŸ‘Š', '✌') { True }
multi infix:<✊>('✌', 'βœ‹') { True }
multi infix:<✊>($ , $ ) { False }
my $p1 = (πŸ‘Š, βœ‹, ✌).roll;
say "Player 1 chooses: {$p1}";
my $p2 = (πŸ‘Š, βœ‹, ✌).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