This is based on my work for Cardle.
All of these will be 5-card hands. Some are more “house rule” variants used in Cardle.
possible_ranks = []
straight_hands = []
# Generate lists of straight ranks, without suits.
for start_rank in 1..11:
hand_ranks = []
for rank in start_rank..(start_rank + 5):
hand_ranks.append(rank)
# Generate all possible suit combinations.
for hand_ranks in possible_ranks:
possible_cards_for_pos = []
for rank in hand_ranks:
cards_for_pos = []
for suit in SUITS:
cards_for_pos.append((suit, rank))
possible_cards_for_pos = cards_for_pos
# Obviously you wouldn't want to nest like this. This
# is purely for readability purposes.
for card1 in possible_cards_for_pos[0]:
for card2 in possible_cards_for_pos[1]:
for card3 in possible_cards_for_pos[2]:
for card4 in possible_cards_for_pos[3]:
for card5 in possible_cards_for_pos[4]:
straight_hands.append([card1, card2, card3, card4, card5])