Anonymous user
Poker hand analyser: Difference between revisions
→{{header|Raku}}: tweak 'rank' and 'straight' subroutines
(→{{header|Raku}}: tweak 'rank' and 'straight' subroutines) |
|||
Line 3,725:
method TOP($/) {
my UInt @n = n-of-a-kind($/);
my $flush = 'flush' if flush($/);
my $straight = 'straight' if straight($/);
make rank(@n[0], @n[1], $flush, $straight);
}
multi sub rank(5,
multi sub rank($,$,
multi sub rank(4,
multi sub rank($,$,
multi sub rank($,$,$,
multi sub rank(3,2,
multi sub rank(3,
multi sub rank(2,2,
multi sub rank(2,
multi sub rank(
sub n-of-a-kind($/) {
Line 3,755:
# allow both ace-low and ace-high straights
constant @Faces = [ "a 2 3 4 5 6 7 8 9 10 j q k a".split: ' ' ];
constant @Possible-Straights = [ (
my $faces = set @<face-card>.map: -> $/ {~$<face>.lc};
|