Basic Examples (4)
When the first card on the flop is 4♢ the best hole cards are any other pair of 4s, which are treated as equally strong:
When no cards have yet been dealt, the best hole cards are 'Pocket Aces':
Find the 10 best hole card combinations for a flop of K♡, 8♢, 5♠:
The many different full houses resulting from a 'wet board' (a board that can make many different strong hands) are ranked :
The elusive royal flush:
Scope (3)
If the community card list has two or fewer cards, then straights, flushes, or full houses cannot be constructed. Here, the top-ranked hole cards result in three-of-a-kind, followed by two-pair, followed by one-pair:
An Ace-to-5 straight (also known as the "wheel") is treated as weaker than a 2-to-6 straight, since Ace is 'low' here:
A straight flush beats an Ace-high flush:
Options (2)
Setting the option "ShowGraphic" → True calls PlayingCardGraphic:
The graphics are returned in the same format as the lists:
Applications (2)
If four cards are already on the table, we technically only need to use one of our hole cards to make a complete five-card hand. The 14th strongest entry (A♣/♡/♠) represents this.
This is usually referred to as "Ace-X". Weaker hole card combinations such as {A♣/♡/♠, 8♣/♢/♡/♠} are included since swapping the 9♣ for 8♣/♡/♠ actively makes the hand 'weaker'.
It is also worth noting that for this example, {Q♣/♢/♡/♠, J♣/♢/♡/♠} makes two distinct straights: T-to-A and 9-to-K. However, only the strongest-performing instance of a given hole card combination is used in the final ranking, so {Q♣/♢/♡/♠, J♣/♢/♡/♠} appears at the first position rather than both the first and second position:
If all five cards have been dealt, all possible combinations of using zero, one, or both hole cards are checked and ranked. Therefore, it takes a couple of minutes to run.
The 29th strongest entry here includes an empty list, representing not using hole cards at all! This means that the five community cards alone would beat any hands made using hole cards below 29th position. This is clear if one looks at the hands below 29th position and recognizes that they represent swapping Q♣ on the board with a lower-ranked card:
Properties and Relations (2)
Use a Take-like specification to find the 4th-9th strongest hole cards:
Alternatively, find the weakest possible hole cards:
Possible Issues (3)
The number of cards in the input must not exceed five:
If there are repeated instances of a given card, it is flagged as invalid since a poker game typically uses a single deck:
An error is flagged for invalid ranks or suits:
Neat Examples (5)
In the 2006 film Casino Royale, there is a now famous Texas hold 'em poker scene in which four players miraculously have very strong hands, resulting in a $115 million pot. We can use this function to explore their relative strength.
First, we note the hole cards that each player held:
We also need the five cards that were on the table:
It would be difficult to know exactly how many unique rankings there are, so we can use Span (;;):
Finally, we find the position within this ranked list of our players' hands:
We can now find the number of unique rankings: