Probability Help - Math Geniuses Here

This is a discussion on Probability Help - Math Geniuses Here within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Trying to get the most accurate pre-flop odds for this scenario: You are dealt two cards out of a standard ...

  1. #1
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Probability Help - Math Geniuses Here

    Trying to get the most accurate pre-flop odds for this scenario:

    You are dealt two cards out of a standard deck of 52. You want to calculate the odds of getting two additional cards that you want on the flop, which will offer you 3 opportunities to get the two cards.

    Here are some examples.. cards_out == the number of cards you need that are still available


    So, I could calculate the odds of getting one card on the 1st flop card.. then add to the odds of getting your second card on the 2nd or 3rd flop card..
    Code:
    (cards_out / 50) + [100 - ( (49-cards_out/49) * (48-cards_out/48) )]
    Or, I could calculate the odds of getting one card on the 1st or 2nd flop card.. then add to the odds of getting your second card on the 3rd flop card.
    Code:
    [100 - ( (50-cards_out/50) * (49-cards_out/49) )] + (cards_out / 48)
    There is also yet another combination.. getting the card you want on the 1st flop card.. not getting what you want on the 2nd flop card.. and then getting the second card you wanted on the 3rd flop card...
    Code:
    (cards_out / 50) + (cards_out / 48)

    Q: Which method would offer the best representation of your odds of getting two cards you need on the flop? should I perform all calculations, and then average them?? Is the difference so negligable that it doesn't matter..??
    Last edited by The Brain; 06-07-2005 at 01:59 PM. Reason: And yes.. I have tried calling 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    A: Buy a poker book. Any halfway decent one will have the answer, among others

  3. #3
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    Hmmm.... I'm not sure what yo mean. Could you please describe the situation in more detail? (Have never liked card games, so... )
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  4. #4
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Let's say you are dealt a 5 of spades and a 10 of clubs.

    You want to calculate your odds of getting two pair. (two 5's and two 10's)

    There are 50 cards still remaining in the deck.

    There are three '5's and three '10's still out, somewhere in the deck.

    You are about to be dealt three cards on the flop.

    What are the odds of getting another 5 and another 10 on the flop?


    Code:
    card 1:  will give you a 6 out of 49 chance of getting at least one of the two cards you want.
    
    card 2:  will give you a 6 out of 48 chance of getting one of the cards you wanted  -OR- a 3 out of 48 chance of getting the second card if you got what you wanted on the 1st card 
    
    (at this point, you must have at least obtained one of the two cards)
    
    card 3:   3 out of 47 of getting the second card
    Last edited by The Brain; 06-07-2005 at 02:54 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  5. #5
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    Now, this is how I understood your problem: You have two cards. Then, you are given three more cards. What are the odds that two of the cards you want are among the three last cards you are given.

    Here is my solution. You have following possibilities for the three last cards (0 - a card you do not want; 1 - a card you want):

    101
    110
    011

    We now sum the possibility of getting each hand. That gives:

    (2/50)(1/49)(48/48)+(2/50)(48/49)(1/48)+(48/50)(2/49)(1/48)~=0.00244897959
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  6. #6
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    You can also go the other way around:

    1-Possibility_of_getting_nothing

    But then you have more choices:

    001
    000
    010
    100

    So the last solution method will be more efficient.
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  7. #7
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    Sorry, for posting so many times. There is yet another and simpler solution. Tell me if you want to know it. I don't know what it's called in english, but I learnt as the Hypergeometrical Method. It involves binomial coefficients.
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  8. #8
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Awesome.. just what I was looking for


    Sure.. post it up.. !


    or if you got link that would be cool
    Last edited by The Brain; 06-07-2005 at 02:48 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  9. #9
    Registered User
    Join Date
    Jul 2004
    Posts
    17
    Sounds like binomial distributions (in english) and involves combinations. Not that complicated really, probably come up in a google (sry i'm in a rush)

    Pete

  10. #10
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    >Let's say you are dealt a 5 of spades and a 10 of clubs.

    That's easy - FOLD!

  11. #11
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    http://mathworld.wolfram.com/BinomialCoefficient.html

    My solution:

    The number of ways the three cards can be chosen: 3 C 50

    The number of combinations including a 5 and a 10: 3 * 3 * 48
    (3 fives, 3 tens and the last card could be anything)

    Divide these two numbers and the resulting probability is 0.022

    EDIT: I'm doing something wrong, but it's late and I'll have to get up early in the morning. Hopefully, you'll spot the mistake.
    Last edited by Sang-drax; 06-07-2005 at 05:27 PM.

  12. #12
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    The problem with the way you guys are doing it is that a pair isn't necessarily "getting two additional cards that you want". The cards you want are going to be dependent on a number of things, not just whether you make a pair or set.

    It may seem like I'm reading into this too much, but if this is actually a poker question and not just a mathematical exercise, the chances are greater than 2.2%.

  13. #13
    Epo
    Epo is offline
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    I'm guessing this to be a game of Holdem? (Never saw it posted, but that's what it sounds like)

    There are two scenarios I'm seeing right off the bat. These don't however get into the fact that other players are being dealt and you don't know whether or not they may have drawn the cards you need:

    Scenario 1: You get two of the same cards
    This would be something like an A A, K K, 9 9, you get the idea. We're going to play with the Dictators this time (K K) because they're cool. Now, off a flop of 3 cards,

    Card #1:
    There are two kings remaining in the deck of 50 cards, so for this card there is a 4.00% chance of getting another king.

    Therefore, by the end of one card being dealt on the flop:
    There is a 96% chance of NOT getting a king
    There is a 4% chance of receiving another king


    Card #2 (Card #1 WAS NOT a king):
    There are two kings remaining in the deck of 49 cards, so for this card there is a 4.08...% chance of getting another king. However, this scenario will happen 96.00% of the time, so in reality, there is a 3.84% chance.

    Card #2 (Card #1 WAS a king):
    There is one king remaining in the deck of 49 cards, so for this card there is a 2.04...% chance of getting another king. However, this scenario will only happen 4.00% of the time, so in reality, there is a 0.0816% chance of this happening.

    Therefore, by the end of two cards being dealt on the flop:
    There is a 92.0784% chance of having 0 kings;
    There is a 7.84% chance of having 1 king; and
    There is a 0.0816% chance of having 2 kings


    Card #3 (NO FLOP CARDS were a king yet):
    There are still two kings remaining in the deck of 48 cards, so for this card there is a 4.166...% chance of a king being dealt. However, this scenario will only happen 92.0784% of the time, so in reality there is only a 3.836...% chance of getting a king on this card.

    Card #3 (1 FLOP CARD was a king):
    There is still 1 king remaining in the deck of 48 cards, so for this card there is a 2.08...% chance of a king being dealt. However, this scenario will only happen 7.84% of the time, so in reality there is only a 0.163...% chance of getting another king on this card.

    Therefore, by the end of three flop cards:
    There is a 88.07...% chance of having 0 kings;
    There is a 11.676...% chance of having 1 king; and
    There is a 0.2446...% chance of having 2 kings


    And that's only the scenario for getting dealt a pair...I can do a scenario of getting two seperate cards if you request it, but it might take a bit of time to post up. I'm very confident this is the appropriate procedure for determining probabilities. And remember, this only holds as long as other players aren't being dealt.

    Note: I did some truncation too. The "..."s after numbers are just numbers I left out to keep it readable, but it will add up to just under 100% of outcomes.

    EDIT:
    This method is off. I read it more this morning and I think I missed a few cases. I'm going to write it all out by hand and then post it here.
    Last edited by Epo; 06-08-2005 at 05:36 AM.
    Pentium 4 - 2.0GHz, 512MB RAM
    NVIDIA GeForce4 MX 440
    WinXP
    Visual Studio .Net 2003
    DX9 October 2004 Update (R.I.P. VC++ 6.0 Compatability)

  14. #14
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Quote Originally Posted by The Brain
    Let's say you are dealt a 5 of spades and a 10 of clubs.

    You want to calculate your odds of getting two pair. (two 5's and two 10's)

    There are 50 cards still remaining in the deck.

    There are three '5's and three '10's still out, somewhere in the deck.

    You are about to be dealt three cards on the flop.

    What are the odds of getting another 5 and another 10 on the flop?
    I counted and got 3.5%.

  15. #15
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Solving this problem by expanding the cases isn't very good. It's easy to miss a few cases and when the problem gets more complex the method becomes really impractical.

    The number of ways the three cards can be chosen: 50 C 3
    This is the same as I posted before.

    The number of combinations exactly one 5 and exactly one 10: 3 * 3 * (50-6)
    (3 fives, 3 tens and the last card could be anything but one of those six cards)

    Divide these two numbers and the resulting probability is 0.0202

    This is the probability to get two-pair (not full house or trips) with the two different cards you hold on your hand after the flop (three cards).

    I'm not sure, but it looks reasonable. The short explanation why my previous solution didn't work is that some combinations were calculated twice.

    Quote Originally Posted by Govtcheez
    the chances are greater than 2.2%.
    The chances are creater because you can get two pairs in more ways, for example 6, 6, 5 in the flop and 5, 10 in your hand, but I think 2.02% answers Brain's question.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Math
    By knightjp in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 04-01-2009, 05:36 PM
  2. how to use operator+() in this code?
    By barlas in forum C++ Programming
    Replies: 10
    Last Post: 07-09-2005, 07:22 PM
  3. Math Header?
    By Rune Hunter in forum C++ Programming
    Replies: 26
    Last Post: 09-17-2004, 06:39 AM
  4. toughest math course
    By axon in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-28-2003, 09:06 PM
  5. Quick math question
    By PJYelton in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 04-03-2003, 09:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21