21
3
Related: Name the poker hand
A straight flush is a poker hand containing five cards of sequential rank, all of the same suit. As part of a straight flush, an ace can rank either above a king or below a two. An ace can rank either high (e.g. A♥ K♥ Q♥ J♥ 10♥ is an ace-high straight flush) or low (e.g. 5♦ 4♦ 3♦ 2♦ A♦ is a five-high straight flush), but cannot rank both high and low in the same hand (e.g. Q♣ K♣ A♣ 2♣ 3♣ is an ace-high flush, not a straight flush).
Challenge
Given N
cards (in any reasonable format) output a truthy value if a straight flush is contained in the poker hand.
Input
N
numbers of cards. (In any reasonable format)
There are four suits; hearts, spades, diamonds, and clubs (H, S, D, C)
.
Each suit has one card for the numbers 2 to 10, plus 4 'picture' cards, Ace, Jack, Queen, and King (A, J, Q, K)
Note: You can take 10 as T
Output
Truthy/Falsy
value
Test case
["AS", "2S", "3S", "4S", "5S"] => true
["3D", "9C", "4S", "KH", "AD", "AC"] => false
["5D", "6D", "7D", "8H", "9D", "10D", "JD"] => false
["JC", "7C", "5D", "8C", "AC", "10C", "9C", "5S"] =>true
[] => false
["AS", "2S", "3S"] => false
["JC", "QC", "KC", "AC", "2C"] => false
[ "2H", "3H", "4H", "5H", "6H", "7H"] => true
Standard code-golf rules apply.
Winning criteria: Shortest code in each lang
1May we assume that there won't be two of the same card in the hand? – Jo King – 2018-07-26T23:52:11.170
@JoKing yep, you wont have the same card twice or more – Luis felipe De jesus Munoz – 2018-07-27T00:48:22.120
4May we take
10
asT
? – Kevin Cruijssen – 2018-07-27T07:13:02.013@JoKing I don't think that can happen IRL. ;-) – Erik the Outgolfer – 2018-07-27T09:08:12.300
4@EriktheOutgolfer I literally have about 5 packs of mixed cards less then a meter away from me – Jo King – 2018-07-27T10:04:05.137
@JoKing I think you are not allowed to play with more than 1 pack of cards, at least on a poker game ;) – Luis felipe De jesus Munoz – 2018-07-27T12:39:07.283