- or download this
my %cardvals;
%cardvals{ @hand[0..4]<num> }++
- or download this
# [234] of a kind
$score += [*]($_,$_-1) for %cardvals.values;
- or download this
# Fifteens
if any( @hand<val> ) ~~ 5 && any( @hand<val> ) ~~ 10 {
...
( grep -> $_<val> ~~ 5, @hand ) *
( grep -> $_<val> ~~ 10, @hand );
}
- or download this
# Runs
SPAN: for 5 .. 3 -> $span {
...
}
}
}
- or download this
Hand = 2,3,3,4 5
2,3,4,5 = 4 points
2,3,4,5 = 4 points
= 8 points total