File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Meaningless Drivel and the fly likes Poker Challenge of the Day Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Other » Meaningless Drivel
Bookmark "Poker Challenge of the Day" Watch "Poker Challenge of the Day" New topic
Author

Poker Challenge of the Day

John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
You are playing Texas Hold'em Poker and are looking at 10 spades - 9 spades. The flop is 8 spades - 7 spades - 2 clubs. What's the probability that you will make a straight or better by the river?

The author of the first correct answer (with the explanation) gets $50 in fake money.
Alan Wanwierd
Ranch Hand

Joined: Jun 30, 2004
Posts: 624
Originally posted by John Smith:
You are playing Texas Hold'em Poker and are looking at 10 spades - 9 spades. The flop is 8 spades - 7 spades - 2 clubs. What's the probability that you will make a straight or better by the river?


What is a "flop"?
How many cards are in my hand?
How many cards do I need to make up my straight?
How many cards from other people can I see? (What are they?)
How many more cards can I/will I get?
Whats "The River"?
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Standard rules of texas hold 'em:

each player is dealt two cards (these are called your "hole cards")
-- round of betting
Three cards are placed in the middle of the table, this is called "the flop" these cards are common to all players
-- round of betting
One card is placed in the middle of the table, this is called "the turn"
-- round of betting
One card is placed in the middle of the table, this is called "the river"
-- round of betting

Player who makes the best 5-card hand out of their two cards and the 5 "community" cards is the winner.

What beats what:
High Card < One Pair < Two Pair < Three of a Kind < Straight < Flush < Full House (3 of a kind + a pair) < 4 of a kind; Straight Flush
[ December 22, 2004: Message edited by: Jessica Sant ]

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
Hold'Em is a weird form of poker whose main feature is that 23 people can play at the same table. It's a seven card stud variant (emphasis on variant).

Each player is dealt two cards down initially. After a round of betting, three cards - the "flop" - are turned face up in the center of the table; these cards are considered to be part of every player's hand. There follows another round of betting, another face up common card, another round of betting, a last face up common card (the "river"), and a final round of betting. At least that's how I remember it.

Each player's "hand" ends up consisting of the five up cards that are commonly held plus the two down cards held by the individual player.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

so -- we're dealt the 10S and 9S for our hole cards

an 8S, 7S and 2C come in the flop.

We can make a straight with these cards:
6S, 6C, 6H, 6D, JS, JC, JH, JD

We can make a flush with these cards (not including above cards):
AS, 2S, 3S, 4S, 5S, QS, KS

Can't make a full house, or 4 of a kind.

There are (52-5) 47 cards left in the deck, and you'll be drawing 2 more cards. There 15 cards that can make us a staraight or better. Dang... if only I could remember the calculation from my dang probability and stats class...
Alan Wanwierd
Ranch Hand

Joined: Jun 30, 2004
Posts: 624
OK - now I'm happy..

Given it a little mroe thought.. and here we go...

We already have 4 cards of the 5 we need - so we just need to know the porbability of getting any of the "good" cards in either of the next 2 to be shown

Given that we have 7S, 8S, 9S, 10S:

We can make a straight with ANY 6 or J
we have 4 spades so we can make a flush with any other spade.
4OK and FH are impossible... so thats all we need to consider:
"good" cards are therefore:
6S, 6H, 6C, 6D, JS, JH, JC, JD, 2S, 3S, 4S, 5S, QS, KS, AS

15 cards.. out of 47..
probability of getting one of the good cards on the first draw is 15/47.
probability of getting one on the second draw (after a bad first draw is 15/46.

Therefore probability of getting a straight or better in the sum of the 2:

(15/47) + (15/46) = 0.645

any comments?
[ December 22, 2004: Message edited by: Adrian Wallace ]
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Jessica: There are (52-5) 47 cards left in the deck, and you'll be drawing 2 more cards. There 15 cards that can make us a staraight or better.

That's right, good start. In fact, with this restatement of the problem, it becomes formal enough -- now you don't even need to know the rules of the Hold'Em to attack it.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
AW: probability of getting one of the good cards on the first draw is 15/47.
probability of getting one on the second draw (after a bad first draw is 15/46.
Therefore probability of getting a straight or better in the sum of the 2:
(15/47) + (15/46) = 0.645


Not quite. Here is the reality check: suppose we go by your methodology, but we can draw the card three times, not two times. Then the probability would be (15/47) + (15/46) + (15/45), which is insanely close to 1. Draw the card one more time, and you will exceed 1. So think again.
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
If I did my arithmetic right, 585/1081. I'll let someone else provide the reason.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Warren wins the honor and the $50! Well, that is assuming that my calculations are correct (I came up with the same result).
Alan Wanwierd
Ranch Hand

Joined: Jun 30, 2004
Posts: 624
Originally posted by John Smith:
AW: probability of getting one of the good cards on the first draw is 15/47.
probability of getting one on the second draw (after a bad first draw is 15/46.
Therefore probability of getting a straight or better in the sum of the 2:
(15/47) + (15/46) = 0.645


Not quite. Here is the reality check: suppose we go by your methodology, but we can draw the card three times, not two times. Then the probability would be (15/47) + (15/46) + (15/45), which is insanely close to 1. Draw the card one more time, and you will exceed 1. So think again.




ah yes perhaps the for the second draw to be succesfull we need the first draw to be a failure....

(15/47) + (32/47 * 15/46) = 0.54???
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
AW: (15/47) + (32/47 * 15/46) = 0.54???

Yeah, that's better. The other way to do it without the use of the conditional probablity is to calc the prob of NOT making it, and substracting it from 1:

1 - ((32/47) * (31/46))

What's your way, Warren? You had some strange numbers in that ratio, but the result is the same.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11471
    
  16

Phil Gordon gives a shortcut in his book for approximating the probability. first, you figure out how many "outs" there are. an out is any card that will "make" your hand. Jessica solved that for us.

If you've still got the turn and the river left, what Phil says you can do is just multiply the number of outs by 4, and get a decent approximation. so, 15 outs * 4 = 60%. This is MUCH easier to do in your head at a table when your staring at someone who re-raised you all-in.

if you've only got the river left, you can multiply the outs by 2 to approximate your chances.
[ December 23, 2004: Message edited by: fred rosenberger ]

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Fred: If you've still got the turn and the river left, what Phil says you can do is just multiply the number of outs by 4, and get a decent approximation. so, 15 outs * 4 = 60%. This is MUCH easier to do in your head at a table when your staring at someone who re-raised you all-in. If you've only got the river left, you can multiply the outs by 2 to approximate your chances.

That's very useful, but how do I use Phil's method to estimate the odds if each of my outs contains more than one card? For example, I have J-J, and the flop is Q-K-A. I want to see the odds of making a full house by the river. Each of my outs consists of two cards, e.g, J+Q, Q+Q, J+A. Now what?
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

Instead of this problem, how about this:

You're playing Texas Hold'Em and are dealt a pair of tens. You buy into the round, and the flop comes out: 10 6 6. You've got a full house on the flop, and go all in, hoping to buy the pot. What are the chances that one of the other players would be holding a 6 and call your all-in and that the next card turned over would be the fourth six, making his 4 of a kind beat your full house?

(Not that this happend to me or anything... )


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11471
    
  16

John: i don't know. :-) The book i read was not really about how to play, but what playing is like. He talks about different kinds of tounaments, life on the road, general guidlines, the rules and history of poker... but not "if your holding K-10 off suit, the flop is a rainbow A-Q-7, the early position person checks, a middle position person bets 1/2 the pot, what do you do in late position if you're short stacked???"

Without putting a lot of though into it, i imagine you'd have to do some quick calculations in your head and add them up... i.e. calculate getting 2 queens are about 6% * 6% (i think - it's early here) or 0.36%. tnow, two kings or two aces would also work, so that give you 3 * 0.36%, or about 1%.

Gettin a jack on either of the next two cards is about 8%. getting an A, K or Q on the other is about 18%. so, 18% * 8% is about 1%.

i think, therefore, your odds are about 2% here. But i'm sure someone will tell me i'm wrong soon.

Joel: your question is much harder. how many other players are there? i think this might make a difference. Of course, Phil would tell you that you went all in with the best hand, and just encountered some bad luck (what he calls a "suck-out").

sorry it happened, dude!!!
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
You're playing Texas Hold'Em and are dealt a pair of tens. You buy into the round, and the flop comes out: 10 6 6. You've got a full house on the flop, and go all in, hoping to buy the pot. What are the chances that one of the other players would be holding a 6 and call your all-in and that the next card turned over would be the fourth six, making his 4 of a kind beat your full house?

Let me see if I can get this one. The second part seems fairly straighforward: there is only one six left, out of 47 unseen cards. So, the probability of it coming up on the turn is 1/47. To figure out the first part, we need to know the number of players, as Fred suggested. Suppose there are 2 players left besides you. It looks to me that the probability of one of them holding a six would be [1 - (46 * 46 * 46 * 46) / (47 * 47 * 47 * 47)] = 0.08. Taking the product of the two probabilities gives is the result:

P(somebody holding a six and the turn is six) = 1/47 * 0.08 = 0.0017
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11471
    
  16

of course, you have the same (more or less) probability of getting that last 10 on the river, thus your four-of-kind 10's beating his four-of-kind 6's.

i assume this is NOT what happened?
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
John Smith:

Yeah, that's better. The other way to do it without the use of the conditional probablity is to calc the prob of NOT making it, and substracting it from 1:

1 - ((32/47) * (31/46))

What's your way, Warren? You had some strange numbers in that ratio, but the result is the same.


Would you believe, a lucky guess?

Actually, I did it the same way as you did, then reduced the fraction to lowest terms like my grade school teacher taught me. I guess I was a geek from an early age.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

Originally posted by fred rosenberger:
of course, you have the same (more or less) probability of getting that last 10 on the river, thus your four-of-kind 10's beating his four-of-kind 6's.

i assume this is NOT what happened?


Unfortunately, this did not happen. Otherwise I would be twlling that story in an entirely different tone.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Next poker challenge: in heads up, pocket 8s beat AK suited with a greater frequency than pocket 5s beat AK suited. Why?
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

5-5 beats A-K outright, but if a two pair shows on the board, and both are higher than 5's, A-K wins by overcard.

There are fewer two-pair combinations on the board that will null pocket 8's.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
$50 to Michael!

Ok, let me propose a real challenge now (I don't know the answer to this one). Suppose you write a Java program that simulates 2 player games only -- a lot of them. The purpose is to rank all starting hands (there are exactly 169 of them) by their probablility of beating the opponent's hand. For the purposes of this simulation, assume that both players are playing very loose -- all hands are played to the river. The results will show that AK suited shows in the top 10 hands, and 55 is way down. Yet if you play AK suited against 55, you will lose most of the time.

The challenge is to explain this seemingly illogical non-transitivity in logical terms.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Originally posted by John Smith:
...AK suited shows in the top 10 hands, and 55 is way down. Yet if you play AK suited against 55, you will lose most of the time.

The challenge is to explain this seemingly illogical non-transitivity in logical terms.


I think we're comparing unlike things here. The probability that A-Ks or A-Ko will beat any single opponent is around 65-67%. The probability that 5-5 will beat any single opponent is about 60%.

Face-to-face, a pair of fives against A-K is a good hand. The odds that A-K will improve with five cards to draw is certainly smaller than the odds it will not. If we're considering just one card to improve, only six cards help A-K; 42 don't.

The odds are agin' A-K in a showdown against any pocket pair. Pocket pairs shold generally be worried only about higher hole pairs at pre-flop. The odds that the board will show two higher pair in five cards are so small that a person holding a hole pair should worry more about a set after the flop than two overcards.
[ January 02, 2005: Message edited by: Michael Ernest ]
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
I think we're comparing unlike things here. The probability that A-Ks or A-Ko will beat any single opponent is around 65-67%. The probability that 5-5 will beat any single opponent is about 60%.

My calcs show similar numbers. And that's precisely what I am struggling with. If AKs beats any single opponent more frequently than 5-5 beats any single opponent, wouldn't it be perfectly reasonable to expect that AKs will beat 5-5?

I didn't get peace of mind from the rest of your explanation -- I am still missing something.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Originally posted by John Smith:

If AKs beats any single opponent more frequently than 5-5 beats any single opponent, wouldn't it be perfectly reasonable to expect that AKs will beat 5-5?

No, but I haven't got time to lay out the explanation right now. In short, a certain number of hands can improve on 5-5 when going to the river. If I hold any two cards higher than five, for example, I've got six cards in the deck that will help me. With a pair, only two cards can help me, barring another pair on the board.

If I did the math, I *believe* the difference in win percentage would reflect this fact. There are also a total of eight cards that can help make A-K, while only four cards can help make 5-5. A-K is therefore more likely to occur. I'm sure this factors in as well.
 
permaculture playing cards
 
subject: Poker Challenge of the Day