# Assumption: @hand[0] == 5; sub is_good( @hand ) returns Bool { # If you have a 10, J, Q, or K anywhere in @hand, you win. if any(@hand) == 10 { return true; } # If you have more than one of anything, you win. my %cardvals; %cardvals{ @hand[0..4] }++; if any( %cardvals.values ) > 1 { return true; } # If you have 3+ cards in a row, you win. for 1 .. 11 -> $start { if all( @cardvals{ ($start, $start+1, $start+2) } ) { return true; } } # If +%suit{@hand[0..3]} == 1, you win. # Note: The suit of the cut-card is irrelevant. my %suits; %suits{ @hand[0..3] }++; if +%suit == 1 { return true; } # Alternately, this could have been written: # if all( @hand[0..3] ) == any( @hand[0..3] ) { # return true; # } return false; }