Monthly Archives: May 2006

Autocomplete Widget from Yahoo!

Yahoo! Developer Network has just released their eagerly awaited AutoComplete widget (among other good things). Very nice!

Bad Beat Jackpots

So, I was playing 3-6 Texas Hold’em at Artichoke Joe’s last night and doing pretty well. I was getting tons of good cards and pushing them to the max. Most of the time, it would get called down to the river, which was good for the pot size, and also meant I usually had to show that I had a legitimate hand and wasn’t just being a bully.

Well, one time I got dealt pocket Aces and I raised before the flop, naturally. I got a few callers that followed me all the way down to the river, and when I turned over my cards, people started giving me advice about what a bad idea it was to raise those before the flop. You see, there was a bad beat jackpot if you have Aces full and get beat. When that happens, you get $5000, the guy who beat you gets $2500, and the table splits another $2500. It’s a nice little bonus.

A few hands later, I got Aces again and raised again, and got called down again. (I told you I was getting good cards.) This time people were apoplectic. They had told me about the bad beat jackpot, and yet I insisted on pushing people out of the pot before the flop. (I think they were a little frustrated with the run I was having, too.) The idea that you should play your Aces passively before the flop to go after this jackpot struck me as ridiculous. On the other hand, $5000 is a nice payday in 3-6, so I wasn’t sure how ridiculous so I decided to work it out.

We know the payoff: $5000. If we can work out the odds of getting the bad beat jackpot by playing passive when we otherwise would not have gotten the jackpot, then we can see how much expectation it would be correct to sacrifice with this play.

First, let’s see what hands we’re talking about. The only hands that beat Aces full are quads and straight flush. Therefore, the hands we want to keep around are pocket pairs and suited connectors. This is a pretty loose game, so let’s assume that pocket tens or better aren’t going to fold to a raise preflop. Also, let’s assume that Ace King suited through Queen Jack suited would not fold to a raise and that 2-3 suited and 3-4 suited would fold pre-flop with or without a raise. (I’m not sure QJs stays in against a raise or that the lower suited connectors stay in without a raise, but it simplifies calculation later.) So we’re talking about the odds of getting Aces full and one of our opponents having 22-99 or 45s-TJs and making either quads or straight flush by the river. For simplification, let’s assume for any of these hands to make their hand by the river, the flop will be promising enough to keep them all the way to the river.

Pocket Aces to Aces Full

OK, first let’s see what our odds of going from AA to Aces full are. There are lot’s of online Texas Hold’em odds calculators out there. Pokulator is a nice fancy one with lot’s of spinny graphics. It will tell you that, given pocket Aces, your chances of getting a full house are 8.5%. However, this includes the possibility of getting three of a kind on the board, giving you, for example, Jacks full. That doesn’t help us, so we have to figure it out ourselves damn it.

First, there are 2,118,760 total board combinations that do not include your two aces (50 choose 5 in combinatorics language (although not notation)). There are two more Aces left, and we need one of them. There are 12 ways of choosing the rank of the other pair (2-K) and 6 ways of choosing the two suits (4 choose 2). Eliminating the aces and the paired rank (8 cards) we have 44 cards left of which two will fill out the board. There are 946 ways to do that (44 choose 2). So, we have 136,224 ways to get to Aces full (2 x 12 x 6 x 946) out of 2,118,760 total board combinations, so we have about a 6.43% of getting Aces full from pocket Aces. Not too bad.

Pocket Pairs to Quads

What are the chances of getting 22-99? Well, there are 1326 possible pre-flop hands (52 choose 2). There are 8 ways to choose the rank (2-9) and 6 ways to choose the two suits involved (4 choose 2). So 8 x 6 / 1326 = 3.62%. Against 9 opponents, we would expect to see .326 such hands.

Given a pocket pair, what are the odds of ending up with quads? Once again, our friend the Pokulator gives us an easy answer: .84%. Once again, however, this isn’t really good enough because one of the four cards has to be an ace. Also, in our earlier calculation, we took into account the odds of getting a pair on the and an ace on the board and we don’t want to count that twice. So what we really want to know is, given a pocket pair and aces full, what are the odds that the pair on the board matches the pair you’re holding? I think this is a simple 1 in 12 (all ranks except the Ace) which is about 8.33%.

So, with passive play, let’s make the assumption that we keep all middle to small pairs to see the flop and that any that might make four of a kind see the river (not likely unless everyone else cooperates in playing passively, but good enough for this exercise). We’ll still make our aces full 6.43% and our oppenents will make quads 8.33% when they have the pocket pair of which we will see about .326 per hand.

So, given pocket aces, we will make aces full and get beaten by quad 2’s through quad 9’s 6.43% of 8.33% x .326, which is about .175% of the time. Not often, obviously, but I have to admit, more likely than I thought – about 1 in 573.

Suited Connectors to Straight Flush

What are the chances of getting 45s-TJs? I’ve worked this out, but it’s posted and re-posted on the web, so I’ll just tell you, it’s 2.11%. Against 9 opponents, we would expect .19 hands with suited connectors.

Given suited connectors, an ace and pair on the board, what are the chances of having a straight flush? Given any of the connectors in our example, there are 4 possible straight flushes (e.g. with 67s, you can get 34567, 45678, 56789, or 6789T). There are 4 aces to choose from. There’s only one card left and it has to pair one of the three cards in your straight flush that are on the board, so you have and each of those has 3 cards available (3 suits besides your straight flush suit). So that’s 4 x 4 x 3 x 3 = 144 ways to make that hand out of 2,118,760 total board combinations or about .00680%.

So what are the odds?

The odds of my Aces turning into Aces full beaten by a medium to small quads is .175%. The odds of my Aces turning into Aces full beaten by straight flush starting with 45s – JTs is .00680%. So the total chances of my Aces turning into Aces full and getting beaten is about .181% (rounding to three significant digits). So, to win an extra $5000, I should be willing to forego 9 dollars (3 small bets) of expectation in the non-jackpot game (i.e. regular poker game).

I admit two things:

  • I am not a trained mathematician and may have made an error in my calculations.
  • If it is correct (or even approximately correct) I am quite surprised at the amount of expectation

Although this number is higher than I expected, I am still not convinced that it is profitable to play passive on your pocket Aces to increase your chance at the jackpot. Next I have to research how much expectation you really are giving up by playing aces passively.

.NET CF ProgressBar performance

I made an interesting discovery today. I was trying to see how long it takes to insert/update about 450 rows in a table one at a time and committing them all at the end. The performance was not horrible compared to doing something similar on SuperWaba for Pocket PC, but certainly not breathtaking – about 30 seconds if memory serves, but I didn’t have a timer on it. That is slow, but as long as it is either background process or you have a progress bar, it shouldn’t bother the user too much.

Then I tried to see what exactly was taking all the time, so I started eliminating code that was doing the insert/update until eventually, the loop was just incrementing the ProgressBar.CurrentValue and nothing else. Guess what? It was taking about 22-23 seconds!

Then I tried taking the progress bar update out and it was less than a second. Because of some dependency issues with code under development I wasn’t able to put the insert/update code back in, but I did try to only update the progress bar ever 40 ‘ticks’ and it was still less than a second.

So here’s the moral to the story: If you use a progress bar in .NET Compact Framework, the cost of an update is somewhere around .05 seconds, so limit the updates of the progress bar to a few increments. Updating the progress bar 400 times will add 20 seconds to the process, but updating it 10 times will add only .5 seconds.