Basic Rules of the Game
One of the most well-known games using playing cards is probably poker (for some reason, the playing cards are called “trump” in Japanese. It seems to have been called this name since it was introduced from Portugal in the 16th century. It has nothing to do with Donald Trump). In regular poker, which is a Draw Poker, the objective is to create combinations of strong cards called hands by rearranging the five cards dealt to the player according to set rules. The player who makes the strongest hand among the players will be the winner.
Texas Hold’em differs from Draw Poker in that players do not exchange cards. Instead, players must predict the strongest hand that can be made using a total of seven cards: two hole cards and five community cards. This is a game in which the aim is to win more chips by placing a larger bet (chips) if the player believes that their hand will be the strongest, and by placing a smaller bet or choosing to drop out if the player believes that their hand will be weaker than the other players’. The only choice a player can make is the amount of their bet, and the card combination itself is determined solely by the cards they are dealt. The way the game progresses and the player’s actions have special names, so it can be difficult to understand, but below we will briefly explain the steps of Texas Hold’em.
Dealer Button and Mandatory Blinds
The person who deals the playing cards is called the dealer, and in Texas Hold’em, the way to identify who the dealer is to place a dealer button on each player to distinguish them from the other players. In reality, the cards are not dealt by the players themselves, but rather by an unrelated third party (the casino’s bunny girl), but a marker is provided to clearly indicate which player is the dealer. The dealer button will be rotated between players in a set order, such as clockwise.
In Texas Hold’em, there are two players who are forced to make bets. The player to the left of the player holding the dealer button is called the small blind, and the player to the left of that is called the big blind. The big blind is the minimum bet, and the small blind is forced to put half that amount into the pot (where chips are collected). For example, if the minimum bet is 10 chips, then the big blind would be 10 and the small blind would be 5.
It is generally said that the small blind and big blind players are at a disadvantage because they are forced to put in chips. In addition, betting action begins with the player to the left of the big blind and is made last by the big blind player (After the flop (second betting round), the small blind will be the first to bet, and the dealer button will be the last to bet.), but it is said that the later the player, the more advantageous it is. Therefore, it is said that the player with the dealer button, who is not forced to bet and has the slowest decision-making turn, is in the most advantageous position. Of course, these roles are taken in turns, so except in cases where the outcome is decided in a short battle, there will generally be no advantages or disadvantages between players.
Betting Round
During the betting round, which is the phase in which players decide how many chips to bet, starting with the player to the left of the big blind (From the 2nd round (flop) onwards, the player in the small blind) and going clockwise, players basically have to choose from the following three actions:
- Call: Put additional chips into the pot equal to the current bet and continue playing.
- Fold: Refuse to pay chips and drop out of the game. You cannot get back any chips you have already put in.
- Raise: Increase your bet and put additional chips into the pot to continue playing. It is common to offer a rate of twice the current bet, but you can raise it to any amount. However, you must raise the amount by more than the previous raise (a raise of twice the current bet will always satisfy this condition).
If a raise is made, another betting round begins with that player. When all players have equal stakes, the betting round ends and the next phase begins.
The three basic actions are listed above, but there are exceptions to the above:
- (Opening) Bet: The first player in the second or subsequent betting rounds can choose not to make a bet (can choose to check) since a bet has already been made, but an additional bet can be made by putting chips into the pot, which is called a bet.
- Check: The first player of the second or subsequent betting rounds can continue playing without placing a bet, and this action is called a check. If all previous players have chosen to check, the player can choose to check. If all players have checked, the betting round ends without any additional betting and moves to the next phase.
- All-in: If a player puts in all of their chips after a raise and the bet is still insufficient, they can continue playing by putting in all of their chips. When an all-in is made, the bet amount is different for the player who put in all-in. If the all-in player wins, they can only receive chips from other players equal to the amount of chips they bet, and the remaining chips are then distributed to the winners with the winner being decided by the players other than the all-in player.
In comics and movies, betting everything (All-in) is sometimes portrayed as a confident act of bullishness, but in reality, when you are losing and don’t have enough chips, you are forced to take one last gamble (thinking, “I don’t have enough chips, but this is my last chance, so forgive me”) and going All-in is the equivalent of that action.
Game Progression
There are four betting rounds in one game. Each phase has a different name and the number of cards open in each phase is different.
- Pre-flop: Betting round from hole cards only
- Flop: Three community cards are revealed and then a betting round begins.
- Turn: One additional community card is revealed and then a betting round begins.
- River: The betting round after revealing the last community card.
If there is more than one player remaining at the end of the river, all cards are revealed to determine the winner. The winner takes all the chips in the pot. This phase is called the showdown. Poker hands, in descending order of strength, are as follows:
- Royal Straight Flush: A set of 10, J, Q, K, and A cards of the same suit.
- Straight Flush: Five cards of the same suit and consecutive ranks.
- Four of a Kind: Four cards of the same rank.
- Full House: Collect 3 cards + 2 cards of the same rank.
- Flush: Collect 5 cards of the same suit (not consecutive ranks).
- Straight: Five cards of consecutive ranks (with different suits).
- Three of a Kind: Three cards of the same rank.
- Two Pairs: Two pairs of 2 cards of the same rank.
- One Pair: Two cards of the same rank.
- High card: No hand. Compare the strength of the card with the highest rank.
If the hands are the same, the ranks are compared to determine the strongest hand. In Texas Hold’em, the ranks of the cards are determined by
\[ \small 2\lt3\lt4\lt\cdots\lt J\lt Q \lt K\lt A, \]
and there is no strength based on the suits of spades, hearts, diamonds, and clovers. Consecutive ranks such as a straight may cycle, for example Q, K, A, 2, 3 also constitutes a straight. The ranks to be compared for each hand are as follows:
- Straight, Straight Flush: The last rank of the consecutive cards in the hand. For example, if you have Q, K, A, 2, and 3, the rank is 3.
- Flush: the highest rank card in hand.
- Four of a kind, three of a kind, one pair: the rank of the hand.
- Full House: The rank of the three cards in a hand.
- Two Pairs: The rank of the two cards with the higher rank.
If the game still cannot be decided, the following rules are used for comparison.
- Four of a kind, three of a kind, one pair: the highest rank card that is not included in the hand.
- Full House: The rank of the two cards in the hand
- Two Pairs: The rank of the two cards with the lowest rank in the hand. If they are the same, the rank of the card not included in the hand.
If the game still does not decide the winner, it is called a draw (known as a tie) and the chips are divided equally between the tied players. If the chips in the pot are not divisible, the remainder will be distributed according to predetermined rules, such as the small blind player (or the winner who had an early turn to take betting action) receiving the remaining chips.
Number of Card Combinations
There are 52 cards in a deck of cards, so there are as many possible combinations of cards as there are after subtracting the five community cards and each player’s two hand cards. For example, if there are four players, there are
\[ \small {}_{52}C_5 \times {}_{47}C_2 \times {}_{45}C_2 \times {}_{43}C_2 \times {}_{41}C_2 = 2.0595 \times 10^{18} \]
possible card combinations. The calculation result will be the same even if you change the order to
\[ \small {}_{52}C_2\times{}_{50}C_2\times{}_{48}C_2\times{}_{46}C_2\times{}_{44}C_5 = 2.0595 \times 10^{18}. \]
The more people who participate, the more combinations there will be. The combination of cards that you can see is:
\[ \small {}_{52}C_5\times{}_{47}C_2\ = 2809475760, \]
which means there are 2.8 billion possible combinations. For this reason, Texas Hold’em is said to be a game in which players never encounter the exact same position. In other words, memorizing the probability of winning based on a combination of your hand and community cards is not a realistic methodology (unless, of course, you are comfortable using artificial intelligence or a computer).
At the pre-flop stage with two cards, the combination of one player’s hand is \(\small {}_{52}C_2=1326\), so it is relatively easy to determine whether or not one has an advantage. For example, it is said that the combination of A and A is the most advantageous. Since there are not many patterns in the pre-flop stage, strategies do not vary much from player to player, and in most cases players will usually play according to the established rules. It seems that this is often the limit of probability-based explanations in books and on websites. At the flop stage, the combination could be
\[ \small {}_{52} C_2 \times {}_{50} C_3 = 25989600, \]
so you will have to rely on intuition to some extent to guess whether it is a combination with a high advantage. Even if you calculate probability, it is not possible to make general statements, so it seems that most books and websites only provide explanations based on empirical rules.
Why Is This Game Featured?
I do not recommend gambling or going to casinos for any reason other than entertainment, and because the human brain has some significant flaws, casinos and gambling venues have a number of mechanisms in place to exploit these and get people addicted to gambling. Still, the game is of interest because it contains many basic elements that are important in the research and application of machine learning and artificial intelligence (AI). (According to chatGPT) In fact, OpenAI was researching artificial intelligence algorithms related to Texas Hold’em under the name DeepStack, and Facebook was researching artificial intelligence algorithms related to Texas Hold’em under the name Pluribus. Specifically, the important basic elements in artificial intelligence research are as follows:
- Since the number of possible situations is astronomical, and it is not realistic to exhaustively test all patterns to calculate the probability or optimal strategy, it is necessary to construct a strategy by learning based on partial sampling (this is an example of achieving generalization ability through deep learning).
- There are state transitions (display of cards, changes in bets) as the game progresses (strategy construction using reinforcement learning can be used).
- There is competition with other players (techniques like self-reinforcement learning and generative adversarial networks can be applied).
- Decisions have to be made based on incomplete information.
Conditions 1 to 3 are also satisfied in Go and Shogi, but condition 4 is not satisfied, so these games are said to be perfect information games. A major feature of perfect information games is that it is theoretically possible to prove the existence of unbeatable strategies (strategies that cannot lose even in the worst case scenario). This means that the more data samples it learns, the stronger the AI will be.
On the other hand, in games of incomplete information such as Texas Hold’em, there is no such thing as a sure-win or unlosing strategy, so it is important to note that no matter how rational your decisions are, there is always the possibility of losing, so there is no such thing as a perfect strategy. In other words, the more you learn, the stronger you will be, but rather things like compatibility between players will become a factor in determining victory or defeat. In this case, it may be necessary to learn rules that allow you to infer your opponent’s character from his or her betting strategy.
As mentioned above, Texas Hold’em seems like a good subject for learning and researching machine learning and artificial intelligence, so why not give it a try? It is worth pointing out that financial market trading, such as stocks and foreign exchange, is also fundamentally a game of incomplete information, and is closer in nature to Texas Hold’em than to Go or Shogi. By the way, in Texas Hold’em, players with more chips (larger stacks) tend to have a strategic advantage (they can force other players to go all-in). This may have something in common with the fact that the richer you are, the more advantageous you are in the financial markets (oops…).
Perhaps because ordinary citizens are not accustomed to deceiving others or often feel guilty about it, players who are new to the game will be more likely to be honest and aggressive when their hands are strong, and fold when their hands are weak. In addition, they are assumed to expect other players to act with a similar strategy. Of course, if the player’s intuitive probability calculations are appropriate even with that strategy, he or she can be considered a fairly strong player, but experienced players will have ways to undermine the strategies of such players (strategies to manipulate information, such as bluffing). If I find myself interested, I might look into the nature of this game a little more.
Appendix. Poker Hand Determination Algorithm
When looking at open source source code, there were cases where prime numbers were used to determine poker hands. For example, the numerical values of the suits spades, hearts, diamonds, and clubs are assigned as \(\small 2,3,5,7\), and the numerical values of the cards \(\small 2,3,\cdots,J,Q,K,A\) are assigned as \(\small 11,13,\cdots,43,47,53,59\), and the cards are represented by multiplying these values. The composition of five cards is expressed by multiplying the numbers that represent those cards. In Texas Hold’em, suits are not used except for determining flushes, so this type of expression may be possible.
This method makes it relatively easy to determine whether a hand is a flush or a straight. For example, if the composite value of the five cards is divisible by any of \(\small 2^5,3^5,5^5,7^5\), it is a flush, and a straight can be determined by preparing 13 arrays in advance, such as \(\small 11\times13\times17\times19\times23\), and if it is divisible by any of these, it is a straight. There may be some research or methodology that examines what algorithms are efficient ways to determine this.
I tried implementing it in Python. I won’t listen to criticism that the code is clumsy and not useful. Only the straight decision is done using prime numbers.
class Card:
SUIT_CHAR = ['S','H','D','C']
#To compare sizes, put A last.
RANK_CHAR = ['2','3','4','5','6','7','8','9','T','J','Q','K','A']
#Prime numbers for determining straights.
RANK_INDEX = [2,3,5,7,11,13,17,19,23,29,31,37,41]
def __init__(self, suit, rank):
self.suit = suit
self.rank = rank
def string_value(self):
return self.SUIT_CHAR[self.suit] + self.RANK_CHAR[self.rank]
def prime_value(self):
return self.RANK_INDEX[self.rank]
class Hand:
#cards is a list of 5 Card types.
def __init__(self, cards):
self.rank_count = [0] * 13
self.suit_count = [0] * 4
self.prime_value = 1
for c in cards:
self.prime_value *= c.prime_value()
self.rank_count[c.rank] += 1
self.suit_count[c.suit] += 1
class Evaluator:
#Check for straights in order of weakest to strongest. Only numbers are used,
#so a straight is only possible if the values are equal.
STRAIGHT_CHECK = [2727566,282162,45510,8610,2310,15015,85085,323323,\
1062347,2800733,6678671,14535931,31367009]
def __init__(self):
pass
def eval(self, hand):
strength = [0] * 4
#Check for straights and flushes
#(since the numbers are all different, only check if the maximum count is 1)
if max(hand.rank_count) == 1:
bFlush = False
if max(hand.suit_count) == 5:
bFlush = True
bStraight = False
if hand.prime_value in self.STRAIGHT_CHECK:
bStraight = True
if bFlush and bStraight:
strength[0] = 8
strength[1] = self.STRAIGHT_CHECK.index(hand.prime_value)
return strength
elif bFlush:
strength[0] = 5
strength[1] = len(hand.rank_count) - list(reversed(hand.rank_count)).index(1) - 1
return strength
elif bStraight:
strength[0] = 4
strength[1] = self.STRAIGHT_CHECK.index(hand.prime_value)
return strength
else:
#High Card
strength[0] = 0
strength[1] = len(hand.rank_count) - list(reversed(hand.rank_count)).index(1) - 1
return strength
#One Pair or Two Pair
if max(hand.rank_count) == 2:
l = hand.rank_count.index(2)
r = len(hand.rank_count) - list(reversed(hand.rank_count)).index(2) - 1
if l == r:
#One Pair
strength[0] = 1
strength[1] = l
strength[2] = len(hand.rank_count) - list(reversed(hand.rank_count)).index(1) - 1
return strength
else:
#Two Pair
strength[0] = 2
strength[1] = r
strength[2] = l
strength[3] = hand.rank_count.index(1)
return strength
#Three of a Kind or Full House
if max(hand.rank_count) == 3:
if 2 in hand.rank_count:
#Full House
strength[0] = 6
strength[1] = hand.rank_count.index(3)
strength[2] = hand.rank_count.index(2)
return strength
else:
#Three of a Kind
strength[0] = 3
strength[1] = hand.rank_count.index(3)
strength[2] = len(hand.rank_count) - list(reversed(hand.rank_count)).index(1) - 1
return strength
#Four of a Kind
strength[0] = 7
strength[1] = hand.rank_count.index(4)
strength[2] = hand.rank_count.index(1)
return strength
# Returns 1 if player 1 wins, -1 if player 2 wins, and 0 if it's a draw.
def compare(self, hand1, hand2):
s1 = self.eval(hand1)
s2 = self.eval(hand2)
for i in range(0, 4):
if s1[i] > s2[i]:
return 1
elif s1[i] < s2[i]:
return -1
return 0
if __name__ == "__main__":
e = Evaluator()
cards = [Card(0, 8),Card(0, 9),Card(0, 10),Card(0, 11),Card(0, 12)]
hand = Hand(cards)
print(e.eval(hand))
Comments