Thread: Help with Poker program

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Help with Poker program

    I'm creating a program which will provide Texas Hold'em poker probabilities and suggestion. I know how to calculate the probability of getting a certain hand. However, I'd also like to find the overall probability of winning. Now I'm not quite sure how to find this out, the only idea that I have is a BruteForce method, trying all possibilities. For every card the opponent could have (and factoring in any community cards not revealed), find out whether it's a win or a loss. Then simply divide the number of wins by overall possibilities. I know this is very ineffecient, I'm not even sure if it's feasible. So my question is, is there any better way to calculate the probability of winning, perhaps by comparing the possibilities of getting certain hands?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You can only know the chances of having a good hand, unless you cheat. You can REALLY only know how likely you are to win if you're cheating by looking at all of the cards dealt.

    All you can do is look at your known cards, and the chances of improving your hand by knowing how many possible outs you have left.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    Well, I don't think that's entirely true. We can't KNOW what the exact probability is, but given what we do know we can give a better guess than 50/50. We know that the better hand we have, the less likely it is that the opponent will win. We know that, we just never crunch the numbers as to why. We know the chance of drawing any one card out of the deck. If I want to draw at least one Ace I have a 4/52 chance. However, If I have an ace I know the opponent only has a 3/51 chance of having one. So If I have a certain hand, I can figure out how likely it is the opponent can beat it based on the cards I have....somehow.

    Example:
    I have a 4 of hearts and a 4 of clubs.
    Community cards: 2 Spades,3 Hearts,5 Diamonds,6 Clubs,King Hearts
    So I have a straight. I know the chance that an opponent has a straight is 2/45. The chance that his straight beats mine is 2/45 * 4/44. Right? Or am I wrong, probability is tricky. At any rate, I could figure out the probability of someone else getting a hand that beats mine. However, I'd like to add into the calculation the chance I have of improving my hand. If it's right after the flop and I'm one away from a flush, I wouldn't want my probability of victory being based solely on the fact that I only have a high card, since the chance is only a little less than 50% that I can complete the flush.

    Talking these things out always helps me figure them out. So right now I think this is what I'll do:

    Step 1: Find out what hand I have
    Step 2: Based on the cards I have, find out how probable it is that an opponent has a better hand.
    Please tell me if I'm wrong, as I'm sure I very well could be. Now to get to the coding. How would the number of players affect the probability, or would it?

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    Well, I'm googling some stuff on it, and though it looks possible It's more complicated than I thought...much more. I may figure it out, but it will take a while.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    However, I'd also like to find the overall probability of winning.
    Without knowing their cards, all you can do is figure out how likely you are to make your hand better, and out of all possible hands, how yours rates.

    You cannot always know if you'll win though, unless you know the hands of the other players. Which would be cheating. That was the point I was making.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why doesn't this poker C program work?
    By hermancarson in forum C Programming
    Replies: 5
    Last Post: 04-09-2008, 09:58 AM
  2. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM