## Tuesday, November 11, 2008

### Chasing Mathematical Rabbits

Well, I am traveling this week for work. What that really means is that I sit in front of the TV a lot after 11-12 hours of work (usually watching the World Series of Poker on ESPN). I know that makes me a little weird. As some of my friends know, I got interested in poker a couple of years because I think it is an interesting mathematical problem.

For me, it is not as interesting when you see all the cards. It is quite simple to calculate the odds of winning when you know the cards (as on ESPN). The interesting problem for me was figuring the best hands to play against whatever number of players that are dealt a hand. Being an engineer and computer programmer, it wasn't enough for me to guess which hands should or shouldn't be played against 8 others players. I spent a great deal of time writing a Monte Carlo program that would:

• Randomly shuffle a deck of 52 cards
• Deal cards for 2-10 players
• Deal the community cards in Texas Hold'em (5 cards)
• Determine the winner
• Repeat millions of times
I now have a database of over 100 million hands. It would give aspiring poker players some insight into when they should chuck their hands. How valid are my simulations that use random numbers to simulate these hands of poker? That is a good question, and I asked it myself. Here is the summary of the community card hands compared to the traditionally calculated statistical probability for each hand:
• Straight Flush: 0.001536% (Sim), 0.001539% (Prob) --> Ratio = 0.99776
• Four of a Kind: 0.023971% (Sim), 0.024010% (Prob) --> Ratio = 0.99838
• Full House: 0.143659% (Sim), 0.144058% (Prob) --> Ratio = 0.99723
• Flush: 0.196929% (Sim), 0.196540% (Prob) --> Ratio = 1.00198
• Straight: 0.393720% (Sim), 0.392465% (Prob) --> Ratio = 1.00320
• Three of a Kind: 2.110972% (Sim), 2.112845% (Prob) --> Ratio = 0.99911
• Two Pair: 4.754903% (Sim), 4.753901% (Prob) --> Ratio = 1.00021
• Pair: 42.249452% (Sim), 42.256905% (Prob) --> Ratio = 0.99982
• High Card: 50.124858% (Sim), 50.117737% (Prob) --> Ratio = 1.00014
So, I have confidence that I programmed the darn "simple" problem right. It still doesn't help my poker game much because my "dumb" players all play the entire hand regardless of their two starting cards.

The next step is a Bayesian approach (using an expert opinion about probable outcomes based on limited information) to eliminate poor starting hands and improve the usefulness results of the program. Since I am not a poker expert, I need help figuring out the fold percentages for each of the 169 starting hands. Don't forget this percentage will change depending on the number of players that have a chance to beat you!

Who's up for the challenge?