Poker and programming

Associate
Joined
18 Feb 2010
Posts
940
OK, i'm thinking about making a little tool for myself to analyse a few hands. I do realize that there are already packages to do this, but I want to learn to do it for myself as a little project.
My program is really to change hand histories a little, it will read in a file, change some of the values, add in the % chance to win in an all in situation, then print it out to a new text file.

So... How on earth to these programs work out how many "outs" a player has, surely the maths behind this is horrendous! Is there an easy way to do this, or even a start?

I thought about it for a while and thought about the number of cards which will improve a hand, but the problem is, it has to also take into consideration the chance of the other hand improving.

If for example, there are two hands...
Would it be possible to work out the % chance of each of the hands ending up on:
Royal flush
Straight flush
4 of a kind,... and so on, and so we have two comparable lists of possibilities for each hand, and then compare these values to find a percentage chance of one winning?
If I had all of them percentages, how would you go about working out the chance to win?

Anyway, if someone could just give me a pointer or a tip, it would be greatly appreciated!

Thanks
 
this sounds like a cool project to go down. I am guessing texas hold em? You would take the cards the player has and analysing every poker hand they can get from that point on and then look at how many of those hands the player will win compared to the other players hands in the same situation as the winning player and then do it again on the flop, bridge and river (have i got the right terms :confused: ) for each player. Sounds like a lot of comparing :p
 
Yeah Tubbz, texas hold'em. It's the flop, turn then river... but you were pretty close :).
I will tell you how I get on with it, i'm going to have a little go at it next time my partner is at work ( monday ).

I suppose working out the odds to improve to a certain hand can't be too hard, for example if they have absolutely nothing, the chance to improve to a pair would be the chance of one of the cards they're holding, or one of the board cards coming out.

e.g, If the board was 2 5 9 ( ignoring suits ).. and the player held A K.
The chance is 15/47 ( 5 values * 3 cards of each value/5 out of the deck of 52 ), add 18/46 ( 6 values * 3 cards of each value/46 cards left )... less the chance of getting two pairs (15/47 * 18/46).... less the chance of them getting a straight... etc etc. I can use a method to work out the highest rank ( royal flush ) first, then to work out the straight flush it needs to take off the chance of getting the royal.. then to work out the 4 of a kind it needs to take off the straight flush and royal... and so on and so fourth all the way down. So I guess the program will work kind of backwards from the top.

I could put that maths in for that fairly easy, and then do the same for 2 pairs ( half done there )... etc etc.
I don't know how i'd compare these values for each player though at the end.
 
Last edited:
Back
Top Bottom