Effective hand strength algorithm

Last updated

Effective Hand Strength (EHS) is a poker algorithm conceived by computer scientists Darse Billings, Denis Papp, Jonathan Schaeffer and Duane Szafron that was published for the first time in the research paper (1998). "Opponent Modeling in Poker" (PDF). AAAI-98 Proceedings.

Contents

It has since then been considered as a reference in the realm of poker artificial intelligence and has been the basis of further research such as:

Algorithm

The algorithm is a numerical approach to quantify the strength of a poker hand where its result expresses the strength of a particular hand in percentile (i.e. ranging from 0 to 1), compared to all other possible hands. The underlying assumption is that an Effective Hand Strength (EHS) is composed of the current Hand Strength (HS) and its potential to improve or deteriorate (PPOT and NPOT):

where:

Pseudocode

Hand Strength (HS) will enumerate all possible opponent hand cards and count the occurrences where our hand is strongest (+50% of the cases where we are tied):

HandStrength(ourcards, boardcards) {     ahead = tied = behind = 0     ourrank = Rank(ourcards, boardcards)      for each case(oppcards) {         opprank = Rank(oppcards, boardcards)         if (ourrank > opprank) ahead += 1         else if (ourrank == opprank) tied += 1         else behind += 1     }      handstrength = (ahead + tied / 2) / (ahead + tied + behind)      return handstrength } 

In addition, EHS will consider the hand potential (i.e. its probabilities to improve or deteriorate):

HandPotential(ourcards, boardcards) {     // Hand potential array, each index represents ahead, tied, and behind     integer array HP[3][3] // initialize to 0     integer array HPTotal[3] // initialize to 0     ourrank = Rank(ourcards, boardcards)      // Consider all two card combinations of the remaining cards for the opponent     for each case(oppcards) {         opprank = Rank(oppcards, boardcards)         if (ourrank > opprank) index = ahead         else if (ourrank == opprank) index = tied         else index = behind         HPTotal[index] += 1          // All possible board cards to come         for each case(turn, river) {             // Final 5-card board             board = [boardcards, turn, river]             ourbest = Rank(ourcards, board)             oppbest = Rank(oppcards, board)             if (ourbest > oppbest) HP[index][ahead] += 1             else if (ourbest == oppbest) HP[index][tied] += 1             else HP[index][behind] += 1         }     }      // Ppot: were behind but moved ahead     Ppot = (HP[behind][ahead] + HP[behind][tied] / 2 + HP[tied][ahead] / 2) / (HPTotal[behind] + HPTotal[tied])     // Npot: were ahead but fell behind     Npot = (HP[ahead][behind] + HP[tied][behind] / 2 + HP[ahead][tied] / 2) / (HPTotal[ahead] + HPTotal[tied])      return [ Ppot, Npot ] } 

Applicability

EHS is applicable to a wide variety of poker games such as Texas hold 'em poker, Omaha hold 'em poker, ...

Given the complexity of the algorithm, it can not be computed manually and has to be used in an Artificial Intelligence context.

Related Research Articles

<span class="mw-page-title-main">Binary search algorithm</span> Search algorithm finding the position of a target value within a sorted array

In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the array.

<span class="mw-page-title-main">Hash table</span> Associative array for storing key-value pairs

In computing, a hash table, also known as hash map, is a data structure that implements an associative array or dictionary. It is an abstract data type that maps keys to values. A hash table uses a hash function to compute an index, also called a hash code, into an array of buckets or slots, from which the desired value can be found. During lookup, the key is hashed and the resulting hash indicates where the corresponding value is stored.

In computer science, a linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched.

Minmax is a decision rule used in artificial intelligence, decision theory, game theory, statistics, and philosophy for minimizing the possible loss for a worst case scenario. When dealing with gains, it is referred to as "maximin" – to maximize the minimum gain. Originally formulated for several-player zero-sum game theory, covering both the cases where players take alternate moves and those where they make simultaneous moves, it has also been extended to more complex games and to general decision-making in the presence of uncertainty.

A check-raise in poker is a common deceptive play in which a player checks early in a betting round, hoping someone else will open. The player who checked then raises in the same round.

A poker player is drawing if they have a hand that is incomplete and needs further cards to become valuable. The hand itself is called a draw or drawing hand. For example, in seven-card stud, if four of a player's first five cards are all spades, but the hand is otherwise weak, they are drawing to a flush. In contrast, a made hand already has value and does not necessarily need to draw to win. A made starting hand with no help can lose to an inferior starting hand with a favorable draw. If an opponent has a made hand that will beat the player's draw, then the player is drawing dead; even if they make their desired hand, they will lose. Not only draws benefit from additional cards; many made hands can be improved by catching an out — and may have to in order to win.

In a poker game with more than one betting round, an out is any unseen card that, if drawn, will improve a player's hand to one that is likely to win. Knowing the number of outs a player has is an important part of poker strategy. For example, in draw poker, a hand with four diamonds has nine outs to make a flush: there are 13 diamonds in the deck, and four of them have been seen. If a player has two small pairs, and he believes that it will be necessary for him to make a full house to win, then he has four outs: the two remaining cards of each rank that he holds.

<span class="mw-page-title-main">Sorting algorithm</span> Algorithm that arranges lists in order

In computer science, a sorting algorithm is an algorithm that puts elements of a list into an order. The most frequently used orders are numerical order and lexicographical order, and either ascending or descending. Efficient sorting is important for optimizing the efficiency of other algorithms that require input data to be in sorted lists. Sorting is also often useful for canonicalizing data and for producing human-readable output.

<span class="mw-page-title-main">Texas hold 'em</span> Variation of the card game of poker

Texas hold 'em is one of the most popular variants of the card game of poker. Two cards, known as hole cards, are dealt face down to each player, and then five community cards are dealt face up in three stages. The stages consist of a series of three cards, later an additional single card, and a final card. Each player seeks the best five-card poker hand from any combination of the seven cards: the five community cards and their two hole cards. Players have betting options to check, call, raise, or fold. Rounds of betting take place before the flop is dealt and after each subsequent deal. The player who has the best hand and has not folded by the end of all betting rounds wins all of the money bet for the hand, known as the pot. In certain situations, a "split pot" or "tie" can occur when two players have hands of equivalent value. This is also called "chop the pot". Texas hold 'em is also the H game featured in HORSE and HOSE.

In poker, the probability of each type of 5-card hand can be computed by calculating the proportion of hands of that type among all possible hands.

In computational complexity theory, the 3SUM problem asks if a given set of real numbers contains three elements that sum to zero. A generalized version, k-SUM, asks the same question on k numbers. 3SUM can be easily solved in time, and matching lower bounds are known in some specialized models of computation.

In computing, a Las Vegas algorithm is a randomized algorithm that always gives correct results; that is, it always produces the correct result or it informs about the failure. However, the runtime of a Las Vegas algorithm differs depending on the input. The usual definition of a Las Vegas algorithm includes the restriction that the expected runtime be finite, where the is carried out over the space of random information, or entropy, used in the algorithm. An alternative definition requires that a Las Vegas algorithm always terminates, but may output a symbol not part of the solution space to indicate failure in finding a solution. The nature of Las Vegas algorithms makes them suitable in situations where the number of possible solutions is limited, and where verifying the correctness of a candidate solution is relatively easy while finding a solution is complex.

<span class="mw-page-title-main">Badugi</span> Draw poker variant

Badugi is a draw poker variant similar to triple draw, with hand-values similar to lowball. The betting structure and overall play of the game is identical to a standard poker game using blinds, but, unlike traditional poker which involves a minimum of five cards, players' hands contain only four cards at any one time. During each of three drawing rounds, players can trade zero to four cards from their hands for new ones from the deck, in an attempt to form the best badugi hand and win the pot. Badugi is often a gambling game, with the object being to win money in the form of pots. The winner of the pot is the person with the best badugi hand at the conclusion of play. Badugi is played in cardrooms around the world, as well as online, in rooms such as PokerStars. Although it hasn’t had its own tournament per se at the WSOP, it is featured in the Dealers Choice events as well as in the Triple Draw Mix. The 2023 WSOP event does have a Badugi tournament scheduled.

<span class="mw-page-title-main">Poker dice</span> Type of die

Poker dice are dice which, instead of having number pips, have representations of playing cards upon them. Poker dice have six sides, one each of an Ace, King, Queen, Jack, 10, and 9, and are used to form a poker hand.

In statistics, the Kendall rank correlation coefficient, commonly referred to as Kendall's τ coefficient, is a statistic used to measure the ordinal association between two measured quantities. A τ test is a non-parametric hypothesis test for statistical dependence based on the τ coefficient. It is a measure of rank correlation: the similarity of the orderings of the data when ranked by each of the quantities. It is named after Maurice Kendall, who developed it in 1938, though Gustav Fechner had proposed a similar measure in the context of time series in 1897.

The following is a glossary of poker terms used in the card game of poker. It supplements the glossary of card game terms. Besides the terms listed here, there are thousands of common and uncommon poker slang terms. This is not intended to be a formal dictionary; precise usage details and multiple closely related senses are omitted here in favor of concise treatment of the basics.

Poker is a popular card game that combines elements of chance and strategy. There are various styles of poker, all of which share an objective of presenting the least probable or highest-scoring hand. A poker hand is usually a configuration of five cards depending on the variant, either held entirely by a player or drawn partly from a number of shared, community cards. Players bet on their hands in a number of rounds as cards are drawn, employing various mathematical and intuitive strategies in an attempt to better opponents.

Reservoir sampling is a family of randomized algorithms for choosing a simple random sample, without replacement, of k items from a population of unknown size n in a single pass over the items. The size of the population n is not known to the algorithm and is typically too large for all n items to fit into main memory. The population is revealed to the algorithm over time, and the algorithm cannot look back at previous items. At any point, the current state of the algorithm must permit extraction of a simple random sample without replacement of size k over the part of the population seen so far.

Libratus is an artificial intelligence computer program designed to play poker, specifically heads up no-limit Texas hold 'em. Libratus' creators intend for it to be generalisable to other, non-Poker-specific applications. It was developed at Carnegie Mellon University, Pittsburgh.

References