Created
August 3, 2016 16:10
-
-
Save zoffixznet/cc38622703091d026be0bb1fa4fd20a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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