4/8/2022

Poker Combination Strength

99

Gameplay: It should be noted that Chinese poker is usually played with 4 players total but can also accommodate between only 2 or 3 players.Each player is dealt 13 cards and must then divvy up their cards into 3 hands of various strengths: (1) their best 5-card hand; (2) a middle strength hand of 5 cards; and (3) their weakest hand that. Players keep their cards hidden, and each player makes bets on the strength of his or her cards. When the round is over, the cards are revealed, and the player with the best hand wins the round and the money that was bet during that round. The game is over when a single player has won all the money at the table.

Last updated: January 1, 2018

I recently took a Hackerrank challenge for a job application that involved poker. I'm not a poker player, so I had a brief moment of panic as I read over the problem the description. In this article I want to do some reflection on how I approached the problem.

The hackerrank question asked me to write a program that would determine the best poker hand possible in five-card draw poker. We are given 10 cards, the first 5 are the current hand, and the second 5 are the next five cards in the deck. We assume that we can see the next five cards (they are not hidden). We want to exchange any n number of cards (where n <= 5) in our hand for the next n cards in the deck. For example, we can take out any combination of 2 cards from the hand we are given, but we must replace these two cards with the next two cards from the deck (we can't pick any two cards from the deck).

  • Postflop Poker Combinations. Let's imagine we are now in a situation where we feel our opponent's range is narrow enough to assign a specific amount of combinations rather than estimate the weightings. Let's look at some examples. Example 1 - The board texture is A 5 2 7 2.
  • The royal flush sits atop the poker-hand rankings as the best hand possible.
  • The poker table features a solid MDF frame for strength and durability and an extra thick armrest for comfort during long games. The 8 inlaid cup holders help to keep the cups in pristine condition, avoid spills, and provide your players with a convenient place to store drinks. The poker table can be tri-folded for space-saving.

Suit and value make up the value of playing cards. For example, you can have a 3 of clubs. 3 is the value, clubs is the suit. We can represent this as 3C.

Suits

Clubs CSpades SHeart HDiamonds D

Value (Rank)

2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace

Hands

Here are the hands of poker

  1. Royal flush (the problem didn't ask me to consider Royal Flush)

    A, K, Q, J, 10, all the same suit.

  2. Straight flush

    Five cards in a sequence, all in the same suit. Ace can either come before 2 or come after King.

  3. Four of a kind

    All four cards of the same rank.

  4. Full house

    Three of a kind with a pair.

  5. Flush

    Any five cards of the same suit, but not in a sequence.

  6. Straight

    Five cards in a sequence, but not of the same suit.

  7. Three of a kind

    Three cards of the same rank.

  8. Two pair

    Two different pairs.

  9. Pair

    Two cards of the same rank.

  10. High Card

    When you haven't made any of the hands above, the highest card plays.In the example below, the jack plays as the highest card.

Evaluating a hand of cards

A hand is five cards. The first thing I did was write out functions to evaluate if a group of 5 cards satisfies the conditions of one of the ten hands.

Poker Combination Strength

Here's a sample hand:

To write functions, I reached for using 2 important python features: set and defaultdict.

Here's an example of a simple function to detect a flush, a hand with cards of all the same suit:

Checking a flush

This function creates a list of the suits in our hand, and then counts the unique elements in that list by making it a set. If the length of the set is 1, then all the cards in the hand must be of the same suit.

But wait, what if we have a straight flush? Also, a hand that satisfies a flush could also be described as a two pair hand. The problem asked me to find the highest possible hand for a given set of cards, so I tried to keep things simple by writing a check_hand() function that checks each hand starting from straight flush down to high card. As soon as a condition for a hand was satisfied, I returned a number that corresponded to the strength of the hand (1 for high card up to 10 for straight flush). The problem didn't include Royal flush, so I will not include that here.

Here's the check_hand function:

This function starts checking the most valuable hands. After it checks the second to lowest hand (pair), it returns a value of 1. This value of 1 corresponds to the 'highest card' hand. Since I'm not comparing the relative value of hands, it doesn't matter what the highest card is, so the number just represents the type of hand that is the strongest.

Other hands

Here are the all of the functions I used to detect hands:

defaultdict is a great built-in that is good to use when you don't know what elements will be in your dictionary, but you know what the initial values of any key that could be added should be. We don't need it here, but the alternative would be to write a very long dictionary where keys are the possible card values and the values of each key is 0.

It would certainly be cleaner and more efficient to write out the above functions into one large function, but I wanted to keep things simple as I was under time constraints.

Strength

The next step in the problem is to determine the best possible hand we can get given the hand we are dealt and the 5 cards on top of the deck. I decided to first solve this problem with brute force. Here was my logic for this part: use itertools to get all combinations of groups of 0, 1, 2, 3, 4 and 5 cards from my hand and add the first 5 - n cards from the deck so we get a five card deck. For each combination of cards we can run check_hand() and keep track of the highest rank hand, and then return that hand as the best hand. Here's the code I wrote for this part of the problem:

Lastly, I need to check each hand and print out the best hand possible. Here's the loop I wrote to do this:

This will accept one round of cards per line:

Poker Combinations Strength Chart

and it will output the following:

Poker Combination Strength

This was an interesting problem to deal with as the solution contained several parts that worked together. While solving the problem I aimed worked through to the end leaving some parts to come back to that I felt confident in solving. Instead of writing each function to check differnt hands at the beginning, I filled most of these functions with pass and moved on to write the next part that involves checking each different combination of cards. Recently having worked through python's itertools exercises on Hackerrank, the combinations functions was fresh in my mind.

Poker Combinations Printable

While I was able to arrive at a solution that satisfied the test cases, I did not have time to think about the efficiency or Big O analysis of the problem.

There is obviously some refactoring that I could do to make things cleaner. With more time I would take an object oriented approach by making classes for cards and hands, and adding class methods to evaluate the hands.

For each round, we have to run check_hand() on each hand combination. Let's think about how many hands we have to evaluate:

We have to consider combinations of cards formed by taking out groups of 0, 1, 2, 3, 4 and 5 cards and adding the next number of cards in the deck that bring the total card count to 5, which means we have to do 5C0 + 5C1 + 5C2 + 5C3 + 5C4 + 5C5 calls to check_hand(). So the sum of total calls is 1 + 5 + 10 + 10 + 5 + 1 = 32.

For each of these 32 calls that happen when we run play(), check_hands() runs through each of the check_ functions starting with the highest value hand. As soon as it finds a 'match', check_hands() returns a number value (hand_value) corresponding to straight flush, four of a kind, etc. This value is then compared with the highest value that has been previously found (best_hand) and replaces that value if the current hand's hand rank has a higher value.

I'm not sure if there is faster way to find the best hand than the brute force method I implemented.

🗣

Poker in 2018 is as competitive as it has ever been. Long gone are the days of being able to print money playing a basic ABC strategy.

Today your average winning poker player has many tricks in their bags and tools in their arsenals. Imagine a soldier going into the heat of battle. Without his weapons, he is practically useless, and chances of survival are extremely low.

If you sit down at a poker table without any preparation or general understanding of poker fundamentals, the sharks are going to eat you alive. Sure you may get lucky once in a blue moon, but over the long term, things won’t end well.

With the evolution of poker strategy, you now have many tools at your disposal. Whether it be online poker training sites, free YouTube content, poker coaching, or poker vlogs, there’s no excuse to be a fish in today's game.

Some of the essential fundamentals you need to be utilizing that every poker player should have in their bag of tricks whether you are a Tournament or Cash Game Player are concepts such as hand combinations (Also known as hand combinatorics or hand combos).

Hand Combinations and Hand Reading

If you were to analyze a large sample of successful poker players you would notice that they all have one skill set in common: Hand Reading

What does hand reading have to do with hand combinations you might ask?

Well, poker is a game of deduction and to be a good hand reader, you need to be good at correctly ranging your opponents.

Once you have assigned them a range, you will then need to start narrowing that range down. Combinatorics is one of the ways we do this.

So what is combinatorics? It may sound like rocket science and it is definitely a bit more complex than some other poker concepts, but once you get the hang of combinatorics it will take your game to the next level.

Combinatorics is essentially understanding how many combos each of your opponent's potential holdings are and deducing their potential holdings utilizing concepts such as removal and blockers.

There are 52 cards in a deck, 13 of each suit, and 4 of each rank with 1326 poker hands in total. To simplify things just focus on memorizing all of the potential combos to start:

  • 16 possible hand combinations of every unpaired hand
  • 12 combinations of every unpaired offsuit hand
  • 4 combinations of each suited hand
  • 6 possible combinations of pocket pairs

Here is a short video example of using combinatorics to count the number of ways a non-paired hand AK can be arranged (i.e. how many combos there are):

So now that we have this memorized, let's look at a hand example and how we can apply combinatorics in game.

We hold A♣Q♣ in the SB and 3bet the BTN’s open to 10bb with 100bb stacks. He flats and we go heads up to a flop of

A♠ 5♦ 4♦

We check and our opponent checks back with 21bb in the middle

Turn is the 4♥

We bet 10bb and our opponent calls for a total pot of 41bb

The river brings the 9â™ 

So the final board reads

A♠ 5♦ 4♦ 4♥ 9♠

We bet 21bb and our opponent jams all in leaving us with 59bb to call into a pot of 162bb resulting in needing at least 36% pot equity to win.

Our opponent is representing a polarized range here. He is either nutted or representing missed draws so we find ourself in a tough spot. This is where utilizing combinatorics to deduce his value hands vs bluffs come into play. Now we need to narrow down his range given our line and his line. Let's take a look at how we do this...

Free MTT Poker Training:

The Underused MTT Skills Essential For Success

  • 5 Day Email MTT Poker Training Course By Poker Pro Kelvin 'Acesup' Beattie
  • 3 Key Skills That Will Take Your MTT Poker Game To A New Level
  • 1.5 Hours Of Professional Poker Training

Blockers and Card Removal Effects

Combination

First, let's take a look at the hands we BLOCK and DON’T BLOCK

Since we hold an Ace in our hand and there is an Ace on the board, that only leaves 2 Ace’s left in the deck. So there is exactly 1 combo of AA.

We BLOCK most of the Aces he can be holding, so we can REMOVE some Aces from his range.

We do not BLOCK the A♦ as we hold A♣Q♣, and the A on the board is a spade, so it is still possible for him to have some A♦x♦ hands.

We checked flop to add strength to our check call range (although a bet with a plan to triple barrel is equally valid in this situation SB vs BTN) and because of this our opponent may not put us on an A here.

If he is a thinking player his jam can exploit our thin value bet on the river turning his missed straight/flush draws into a bluff to get us to fold our big pocket pairs and even make it a tough call with our perceived weak holdings.

The problem in giving him significant credit for this part of his bluffing range is the question of would he really shove here with good SDV (Showdown Value)?

These are the types of questions we must ask ourselves to further deduce his range along with applying the combinatoric information we now have.

Now, let's look at all the nutted Ax hands our opponent can have.

If he has a nutted hand like A4 or A5, and we assume he is only calling 3bets with Axs type hands, the only suited combo of those hands he can have are exactly A♥5♥. He can’t have A♦5♦ or A♦4♦ because the 4 and the 5 are both diamonds on the board blocks these hands.

Lets take a look at all of this value hands:

Poker hand combinations pdf

There is only 1 combo of 44 left in the deck, 2 combos of A9s, 3 Combos of 55, 3 Combos of 99, 2 Combos of 45s - some of these hands may also be bet on the flop when facing a check.

So to recap we have:

1 Combo A5s, 2 Combos of A9s, 3 Combos of 55 (With one 5 on board, the number of combinations of 55 are cut in half from 6 combos to 3 combos), 1 Combo of 44, 2 Combos of 45s, 3 Combos of 99

Total: 12 Value Combos

Now we need to look at our opponent's potential bluffs

Based on the villain's image, this is the range of bluffs we assigned him:

K♦Q♦(1 Combo), J♦T♦ (1 Combo), T♦9♦ (1 Combo), 67s (4 Combos)

He may also turn some other random hands with little showdown value into bluffs such as A♦2♦/A♦3♦

Total: 9 Bluff Combos

9(Bluff Combos) + 12(Value Combos) = 22

9/21 = 42% of the time our opponent will be bluffing (assuming he always bets this entire range)

11/21 = 58% of the time our opponent will be value raising

Now, this is the range we assigned him in game based on the action and what we perceived our opponents range to be.

We are not always correct in applying the exact range of his potential holdings, but so long as you are in the ballpark of that range you can still make quite a few deductions to put yourself in the position to make the correct final decision.

According to the range we assigned him, he has 11 Value Combos and 9 Bluff Combos which gives us equity of 42%. This would result in a positive expected value call as we only need 36% pot odds to call.

Poker Combination Calculator

However, unless you are playing against very tough opponents you will not see someone bluffing all 9 combos we have assigned - most likely they will bluff in the range of 4-6 combos on average which gives equity in the range of 20-30% equity. This is not enough to call.

Poker Hand Combinations Pdf

We ultimately made our decision based on the fact that we felt our opponent was much less likely to jam with his bluffs in this spot. Given that it was already a close decision to begin with, we managed to find what ended up being the correct fold.

Now this all may seem a bit overwhelming, but if you just start taking an extra minute on your big decisions you’d be surprised how quickly you can actually process all this information on this spot.

A good starting point is to simply memorize all of the possible hand combinations listed above near the beginning of the article.

Get access to our 30-minute lesson on Combinatorics and PokerStove by clicking on one of the buttons below:

Conclusion On Combinatorics

Eventually accounting for your opponent's combos in a hand will become second nature. To get to the point that , a lot of the work needs to be done off the table and in the lab. As you spend more time studying it and reviewing hand histories like the one above, you will find yourself intuitively and almost subconsciously using combinatorics in your decision making tree.

But the work will be worth the effort, as being able to count combos on the fly will add a new dimension to your game, allow you to make more educated decisions, become a tougher opponent to play against and move away from playing ABC poker.

Card Combinations Poker

Want more content like the ones in this blog post on poker combinatorics? Check out our Road to Success Course where we have almost 100 videos like this to help take your game to the next level. You can also get the first module of the Road To Success Course for Free - for more details see the free poker training videos page by TopPokerValue.com.

Facebook Comments