I am trying to estimate the value of poker situations for texas hold'em headsup poker between two players. My model looks like this

sb h0.5 s0 s0 6000-12

 sb = small blind (in chips)
 h  = hand strength (0-1 range)
 s0 = (s means showdown) our stack (in chips)
 s0 = (s means showdown) opponent's stack (in chips)
 6000-12 = 6000 pot (in chips) 12 means (1 and 2) meaning player 1 and player 2 is in the pot

so this means both went allin for a showdown

another situation is:

sb h0.8 w2990 f2980 30-1

w means win and f means fold 30-1 means there's 30 in the pot which player 1 has won

so in this case player 2 has folded and player 1 won the pot

one more example:

sb h0.1 w0 f2980 3020-1

in this example player 1 has went allin player 2 has folded and player 1 has won the pot 3020 in chips

this model is the terminal situation for one round of playing cards. the headsup match starts with each 3000 stack blinds 10-20 and blinds increase every 10 hands by 25 chips my current goal is to dominate against some simple strategies like going all in every hand and raising minimum every hand. for this i run a tournament simulation that lasts for 10 matches.

I've tried various formulas but I couldn't get the player to play reasonably well.

some considerations that might help:

  • something to force the player to play his strong hands and get maximum value
  • something to prevent the player risking more than his hand strength
  • something to prevent the player folding to small raises even when his hand strength is low.

here are some specific comparisons, that I am not exactly sure how to compare:

  sb h0.5 w1000 f4500 500-1
  sb h0.5 s1000 s4000 1000-12
first case wins 1000 uncontested, second case wins 500 half of the time.

  sb h0.5 w4000 f1000 1000-1
  sb h0.8 w4000 f1000 1000-1
the stacks and wins are equal except the hand strength is different.

  sb h0.5 w1000 f4500 500-1
  sb h0.5 s500 s4500 1000-1
player 1's stack is equal in each case after winning, but in first case player 1 risked less

  sb h0.8 s0    s0    6000-12
  sb h0.5 f3000 w2900 100-2
a case between going allin with a good hand vs folding a decent hand

one drawback with my model is, in a win-fold situation i can't decide how much a player won from opponent's stack,

for example i cant differentiate these two scenarios

player 1 bet 300 and player 2 folds sb h0.5 w700 f4000 300-1 or

player 1 bet 100 player 2 calls player 1 bet 100 more model can look exactly the same sb h0.5 w700 f4000 300-1

the difference is the starting stacks but i don't have that information. one solution is to include the starting stacks in the model, but I am not sure if this is relevant or makes any difference.

finally I am not considering advanced factors like slow playing or bluffing based on previous round history. Just looking for a game theory optimal player that plays based on odds.

So besides your general comments about this approach, I am asking for a function that estimates the value of a situation in [0, 1] range.

  • Is it a poker question? Or a programming question?
    – Boba Fit
    May 29, 2023 at 13:22
  • It is a poker question, why would it be a programming question.
    – eguneys
    May 29, 2023 at 13:35
  • "I am asking for a function..." That's a programming question.
    – Boba Fit
    May 29, 2023 at 15:52
  • no function is a math term as I described in tags. So instead of criticizing my methods, why don't you provide something useful.
    – eguneys
    May 29, 2023 at 16:01

1 Answer 1


Here's what I came up with, it get's an edge against min raiser and caller and gets even against max raiser.

  let reveal_factor = middle.length / 5

  let strength = ehs(round.stacks[0].hand!, middle)

  let [r, a, b, c, d] = [0.05, 0.27, 0.18, 0.2, 0.3]
  let policy = ((strength - 0.5) / 0.5) * 0.2

  a -= policy
  b += policy

  const se = (n: number) => (n / 3000) - 1
  let res = r * reveal_factor + a * se(safe_stack) + b * (showdown_value / 6000) * strength - c * se(round.stacks[1].stack) + d * ((foldwins[0] > 2000 ? 0 : foldwins[0])/ 6000)

middle is the middle cards safe_stack is player's stack that hasn't put into the pot. foldwins contains each players wins against other players folds (0 if opponent hasnt folded).

Feel free to share your ideas and suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.