Project: Poker Odds Calculator
Know that I had a poker hand classifying program, I wanted to put it to use. The first thing that came to mind was a small detail on televised poker. Whenever you're watching poker on TV (and you can see everyone's cards), they often display a figure such as "Player A has a 52.3% chance of winning"; I wanted to be able to come up with that number. Why? I'm hoping learning how to get these values will give me some insight into writing a half-decent poker playing program, which is currently my longest ongoing project.
Be careful with the program below, since it uses a rather naive brute-force algorithm to determine the odds (enumerate all possibities, and determine the winner for each approach), hitting the "Calculate Odds" with less than 3 community cards might take a while.
And if you're a real numbers guy, you'll notice that my program isn't technically "accurate." Since in poker the pot can be split 2 ways, 3 ways, 4 ways, or really between any number of people, not every "split" holds the same weight. For instance, if you split a given pot with two other people, that should really count more than splitting the same pot with 4 other people. However, my program (for simplicity) counts all splits as equal. In other words, the program is only exactly correct (except for floating point errors, of course), for the 2 person case. As a side note, a statistically solid way to deal with the above problem would be to count a 3-way split as "one third of a win for each party involved", or more generally a k-way split as "one kth of a win for each party involved".