# Meaning of numbers in PioSolver

## Introduction to Ranges and strategy.

In PioSOLVER, the fundamental concept is the range. A player's range refers to the set of possible hands that a player may hold at a given point in the game. In the context of poker, it is often valuable to consider the range of an opponent in order to make more informed decisions.

One way to practice this concept is through playing a variant of Texas Hold'em in which players do not see their own hole cards. The rules of the game are otherwise identical to standard Hold'em, with each player being dealt two cards at the beginning of each hand. However, instead of looking at their own cards, players must develop a strategy for each possible hand within their range. This may involve creating a list of actions to take for different combinations of hole cards, such as: "If my hand is 2c2h, then my action is X" or "If my hand is 2c2d, then my action is X."

After the player has determined their strategy for all possible hands within their range, they can pass their notes to an assistant who is allowed to view the player's actual hole cards and announce the appropriate action based on the strategy provided. Despite not knowing their exact holdings, the player knows that their hand is one of the hands they have decided to take a particular action with.

At the beginning of a hand, a player's range is considered to be 100% of all possible hands. As the hand progresses and the player is faced with decisions, their range is narrowed down to a subset of hands consistent with their actions. This process of range-splitting can be challenging to execute in practice, as it requires players to dissociate their strategy from their actual hole cards and avoid giving away any tells. Nevertheless, this is the problem that PioSOLVER is designed to solve.

## Mixed strategy

Above we talked about strategy being an action selected for a hand. In practice the player can sometimes do a different thing in the exactly same situation and his strategy might be "with hand H, do X 90% of the time and do Y 10% of the time". In this case if player plays X then the range for action X will contain 90% of the hand H from before the action.

So at the start of the hand, each possible holding is equally likely and has 100% weight, and everytime a player has action he defines strategy for each hand (which is a probability distribution for each action). And the resulting action range is the range before the action multiplied by the strategy for the selected hand.

## Range weight vs real frequency.

In PioSOLVER, the range can be interpreted as a relative probability distribution between hands, with a higher weight indicating a higher likelihood of that hand being held by the player. However, it is important to note that the relative probability of hands within a range can be affected by external factors such as the distribution of community cards and the ranges of other players.

For example, in a standard Texas Hold'em game even if a player has a hand such as two black Aces as 100% in their range, they would no longer be able to hold that hand if an Ace of Spades is revealed on the flop.

For example, imagine a scenario in One-Card Poker in which one player's range is (A, K, Q) and the second player's range is (A, K) all cards with 100% weight. The naive calculation would suggest that player 1 is equally likely to have A, K, Q. However, once the second player's range is taken into account, the probability distribution of hands in Player's 1 range changes. In this scenario, both an Ace and a King in Player 1 range can match only 1 combo in the second player's range, while Queen can match 2 combos. Therefore, the real probability is A:25%, K:25%, Q:50%. Even though all those hands have the same weight in the range.

In PioSolver it's possible to see both of those probabilities (the default value is controlled by a setting and both are visible when hovering over action squares in the Browser tab).

## Matchups - more about real frequency

In PioSOLVER, the concept of Matchups is used to compute the real frequency of hands and lines in a range. A matchup is defined as a single hand of weight 1 playing against another hand of weight 1. For example, in a river case where the out of position (OOP) player has a total of 2 combinations and the in position (IP) player has 4 combinations, there will be a total of 8 matchups.

It's important to note that the weight of each hand is considered when calculating matchups. A matchup between hands with smaller weights (e.g. 0.5 against 0.4) will be counted as the multiplication of their weights (`0.5 * 0.4 = 0.2`

in this case).

In addition, matchups at a split point (e.g. decision of a new street) are calculated as the sum of matchups in children, and expected values are averages of expected values in children weighted with matchups.

Matchups have several properties that are worth noting:

- The total number of matchups for the OOP player will be equal to the total number of matchups for the IP player, as each matchup is played by both players.
- The number of matchups from equity calculation will be equal to the number of matchups from expected value calculation, as they both iterate the same number of hands.
- In the aggregation plugin, the sum of matchups for all flops will be the same number as the sum of matchups of all player's hands, as it's the same thing, but split by different criteria.

Matchups can be used to compute the real frequency of hands in a range, as well as the real frequency of certain lines. For example, even if a strategy is 50%-50% when counting combinations, the real action frequency might be 55%-45%.

Matchups can also be used to compute the real frequency of certain flops. For example, if ranges are not symmetrical (as is the case with most practical ranges in Hold'em), some flops may be more likely than others.

In order to determine the relative likelihood of a specific flop (e.g. 222 vs AAA) for a 3-bet scenario, one can calculate the number of matchups for the starting ranges on each board. For instance, using the default 3BetPot ranges from PioSOLVER, one can obtain 123'956'613 matchups on the AAA board and 190'261'566 matchups on the 222 board. This indicates that the 222 flop is approximately 50% more likely to occur in this scenario.

## Equity calculation

Equity, in its most basic form, is defined as the percentage of the pot that a player will win on average in the absence of further betting. The method for calculating equity involves enumerating all possible matchups and classifying them into three groups: matchups won, tied, and lost.

The equity is then calculated as follows: `(matchups won * 100% + matchups tied * 50%) / (total matchups)`

.

When using the calc_eq or calc_eq_node command in PioSOLVER, the output will be the equity for each hand, as well as the total number of matchups for each hand.

## EV calculation

Expected Value (EV) is a measure of the average profit that a player will make over all possible matchups and following a specified strategy across the entire game tree. In order to calculate EV, it is necessary to have an explicit game tree with all possible bets, community cards, etc. and fixed strategies for both players in all possible spots.

The EV of a single matchup is equivalent to the result of the hand, i.e. profit for the winner and loss for the loser. For example, in the following scenario: Starting Pot = 100 Out of Position (OOP) player bets 50, In Position (IP) player raises 150, OOP player folds

The EV from this matchup for OOP is -50 and for IP is 100 + 50 = 150.

Expected value is calculated by taking all possible matchups and all possible betting sequences, computing the average, and weighting it by the matchup probability.

## MES EV calculation and exploitability

The Maximum Exploitability Strategy (MES) EV for a certain player is the result of an EV calculation where the strategy of that player is replaced with the one that yields the highest EV. The exploitability is defined as the difference between the EV of the current strategy and the MES EV.

It's worth noting that minimizing the EV of the opponent is not the same as maximizing the MES EV. In zero-sum two-player games, the two concepts are equivalent. However, in PioSOLVER, it is possible to perform calculations that include rake and ICM, which make the game no longer zero-sum. Therefore, in a non-zero-sum EV model, a solution with zero exploitability could mean that one player can change their strategy to profit at the expense of the other player.

The exploitability number reported in the PioSolver is calculated as `(MES(OOP) - EV(OOP) + MES(IP) - EV(IP)) / 2`