A NPC Model that Duplicate Stats (Part 1)

Probability

Overview

I’m currently developing an iPhone version of my poker app, “Exotic Poker,” but I’m not feeling very motivated. I’m basically copying and pasting existing features, using tools like Claude Code, but I’m hesitant to completely outsource the development, and I’m worried I won’t be able to maintain it later. If all goes well, I’d like to release it around June, but I’m sure it won’t go smoothly, so it’ll probably be around July or August. On the other hand, I feel that the current NPC algorithm in the Android version is pretty weak, so I’m thinking of coming up with a new NPC algorithm and adding it.

 Previously, when I compiled information on HUDs in poker, I mentioned wanting to create an algorithm for NPCs that would act in a way that closely matches a given set of stats. While real-world stats depend on the actions of opponents and aren’t solely determined by one’s own actions, it should be possible to devise an algorithm that selects actions to achieve a certain predetermined ratio. Let’s consider what’s needed to implement this algorithm.

 At this point, I don’t have a clear idea of ​​what to incorporate, so it will likely take some time, but I hope to complete it eventually by steadily thinking about the parts. If this can be implemented, it is expected that players will be able to play against NPCs that behave in a fairly human-like manner. If it can reach the point where players can play against NPCs that employ strategies somewhat similar to GTO by appropriately specifying the stats, it will become a game that is easy to use as an app for solo practice. The basic idea is to extend the algorithm discussed in

so that it can be used for competitive play even in single-player mode. Links to subsequent posts in this series will be added here.

Hand Evaluation

Since an algorithm for evaluating hand strength using the Monte Carlo method has already been implemented, we will utilize this. Hand evaluation will basically be in a position-independent format, and position-dependent strategies will be reflected using statistics. We would like to consider later methods of actively using bluffs (strategies such as showing aggressive actions even with weak hands to make it difficult for opponents to choose to fold against aggressive actions, or to force them to fold strong hands), but we will initially implement a logic that adopts stronger actions in order of the probability of winning. In games where the opponent changes frequently, such as social games and fast-fold games, where the value of bluffs is lower, this can be considered a strategy that can be justified to some extent.

Pre-flop

Generally, the four most important metrics for determining pre-flop strategy using statistics are VPIP, PFR, 3Bet, and F23B. Each metric represents the ratio of the following actions.

  • VPIP: The ratio of calling and raising against your own inaction.
  • PFR: The ratio of raising to a situation where there is no action (including other players) or a limp-in.
  • 3Bet: The ratio of raising against an opening raise (2bet).
  • F23B: Fold ratio against a 3bet

VPIP and PFR can be confusing, but it’s important to note that VPIP is conditioned only on your own actions, while PFR depends on the actions of other players, specifically the ratio of when you make your first raise. Generally, VPIP > PFR, but since the denominators are not the same, this could be reversed with a small sample size.

 On the other hand, these indicators alone are insufficient to define the overall behavior of NPCs, and more parameters need to be added. For example, how often they fold in response to an Open Raise, and what proportion of their choices other than folding are needed in response to a 3Bet. Specifically, the following can be added: In a 100bb game, a 5Bet usually results in an all-in, so the upper limit should be set to 5Bets.

  • F22B: Fold ratio against an opening raise (2bet)
  • 4Bet: The ratio of raising against a 3Bet.
  • F24B: Fold ratio against a 4Bet
  • 5Bet: The ratio of raising against a 4Bet.
  • F25B: Fold ratio against a 5Bet

We can make decisions based on these ratios, and assume that for hands not included in them, we will choose to call. This can be summarized in the table below. \(\small x\) is defined as a hand whose win rate falls within the top \(\small x\)%.

RaiseCallFold
Non Openx ≦ PFRPFR < x ≦ VPIPx > VPIP
Open Raise (2Bet)x ≦ 3Bet3Bet < x < 1-F22Bx ≧ 1 – F22B
3Betx ≦ 4Bet4Bet < x < 1-F23Bx ≧ 1 – F23B
4Betx ≦ 5Bet5Bet < x < 1-F24Bx ≧ 1 – F24B
5Bet x < 1-F25Bx ≧ 1 – F25B

The following constraints are likely necessary: ​​5Bet ≤ 4Bet ≤ 3Bet ≤ PFR ≤ VPIP, and F25B ≥ F24B ≥ F23B ≥ F22B ≥ 1-VPIP. While a simplified approach like PFR = 1-F23B, 3Bet = 1-F24B, etc., it’s generally assumed that hands that use PFR but fold the 3Bet will not be the same as hands that use PFR and call the 3Bet, so it’s better to allow separate settings.

Reflection of the Impact of the Number of Players and Positions

I have considered this before, and I will use the content from the following page.

Reflection of the Effects of Stacks and Ante

The commonly known optimal values ​​for stats (such as VPIP = 20%) are based on a 100bb game with a 0 ante, and it’s important to note that these optimal values ​​will differ depending on the stack size and ante. As the stack size decreases, VPIP and 3-bet values ​​tend to be higher, while larger ante values ​​result in higher VPIP. Therefore, it’s necessary to prepare an appropriate betting table and adjust your strategy according to the game situation.

Summary

While I’ve summarized pre-flop strategies, it’s important to note that this doesn’t mean the stats will be observed exactly as set. These strategies only define how to act for the top \(\small x\)% of hands, so actions like 3-bet will generally differ from the set values. For example, 6-8% is considered a good 3-bet, and the corresponding set value is estimated to be around x=3-4%. The denominator for 3-betting in the stats represents the opportunities to 3-bet, but this opportunity doesn’t occur for every hand (if you fold first, the denominator becomes smaller). Game designers need to carefully set these parameters.

 Based on the content of this article, it should be possible to determine pre-flop strategies. In subsequent articles, we will discuss post-flop strategies.

Comments