Let's say you want to iterate through all of the possible combinations
that occur when you choose 7 cards from a fifty two card deck. Anyone
know the best way to do this?
Thanks.
|
|
0
|
|
|
|
Reply
|
bob136 (381)
|
10/4/2005 5:51:14 PM |
|
bob@coolgroups.com wrote:
) Let's say you want to iterate through all of the possible combinations
) that occur when you choose 7 cards from a fifty two card deck. Anyone
) know the best way to do this?
What the best way is depends on why you would want to iterate through all
possible combinations, how you want to represent those combinations, and
probably a lot of other factors as well.
I can probably come up with some code for this, but I doubt it will be
the 'best way' in every way.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
|
|
0
|
|
|
|
Reply
|
willem (1478)
|
10/4/2005 5:59:48 PM
|
|
<bob@coolgroups.com> wrote in message
news:1128448274.935279.78050@g47g2000cwa.googlegroups.com...
> Let's say you want to iterate through all of the possible combinations
> that occur when you choose 7 cards from a fifty two card deck. Anyone
> know the best way to do this?
Are the same cards, but in a different order, a different combination?
--
Roger
|
|
0
|
|
|
|
Reply
|
rkww (271)
|
10/4/2005 6:52:55 PM
|
|
I'm trying to analyze the Texas Holdem probabilities.
Roger Willcocks wrote:
> <bob@coolgroups.com> wrote in message
> news:1128448274.935279.78050@g47g2000cwa.googlegroups.com...
> > Let's say you want to iterate through all of the possible combinations
> > that occur when you choose 7 cards from a fifty two card deck. Anyone
> > know the best way to do this?
>
> Are the same cards, but in a different order, a different combination?
>
> --
> Roger
|
|
0
|
|
|
|
Reply
|
bob136 (381)
|
10/4/2005 9:26:15 PM
|
|
bob@coolgroups.com wrote:
) Roger Willcocks wrote:
)> <bob@coolgroups.com> wrote in message
)> news:1128448274.935279.78050@g47g2000cwa.googlegroups.com...
)> > Let's say you want to iterate through all of the possible combinations
)> > that occur when you choose 7 cards from a fifty two card deck. Anyone
)> > know the best way to do this?
)>
)> Are the same cards, but in a different order, a different combination?
)
) I'm trying to analyze the Texas Holdem probabilities.
So order doesn't matter, I guess ?
Well then it's real easy:
for (c1 = 0; c1 < 52-6; c1++)
for (c2 = c1+1; c2 < 52-5; c2++)
for (c3 = c2+1; c3 < 52-4; c3++)
for (c4 = c3+1; c4 < 52-3; c4++)
for (c5 = c4+1; c5 < 52-2; c5++)
for (c6 = c5+1; c6 < 52-1; c6++)
for (c7 = c6+1; c7 < 52-0; c7++)
do_something(c1,c2,c3,c4,c5,c6,c7);
If you want a more general routine that can handle different numbers of
cards, that's not much more complex, but quite a bit harder to think of.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
|
|
0
|
|
|
|
Reply
|
willem (1478)
|
10/4/2005 9:44:02 PM
|
|
"Willem" <willem@stack.nl> wrote in message
news:slrndk5tt2.rmp.willem@toad.stack.nl...
> bob@coolgroups.com wrote:
> ) Roger Willcocks wrote:
> )> <bob@coolgroups.com> wrote in message
> )> news:1128448274.935279.78050@g47g2000cwa.googlegroups.com...
> )> > Let's say you want to iterate through all of the possible
> combinations
> )> > that occur when you choose 7 cards from a fifty two card deck.
> Anyone
> )> > know the best way to do this?
> )>
> )> Are the same cards, but in a different order, a different combination?
> )
> ) I'm trying to analyze the Texas Holdem probabilities.
>
> So order doesn't matter, I guess ?
According to
http://www.learn-texas-holdem.com/how-texas-holdem-is-played.htm (now
there's an apposite url, even if I say so myself), each player is dealt two
cards and has to select a poker hand from those two cards and five
separately dealt pool cards usable by all players.
Betting occurs after the player receives two cards, and after the pool gets
three, four then five cards.
So it looks like order does matter.
--
Roger
|
|
0
|
|
|
|
Reply
|
rkww (271)
|
10/4/2005 11:04:00 PM
|
|
why does it look to you like order matters?
|
|
0
|
|
|
|
Reply
|
bob136 (381)
|
10/5/2005 11:21:50 AM
|
|
bob@coolgroups.com wrote:
> why does it look to you like order matters?
>
In the loops solution (seven nested loops), the last variable never
takes the first value. Translating to cards, it means that you're
assuming that the last card on the table can never be the ace of spades.
This assumption would change the probabilities considerably (and is
definitely wrong for a game of poker).
So if you want a call/fold/raise winning probabilities after each card,
you can't just go through all possible 7-card sets, you have to look at
the order of the cards in each set as well.
|
|
0
|
|
|
|
Reply
|
spammer16 (12)
|
10/5/2005 11:54:41 AM
|
|
In article <di0eaa$pf$1@reader-00.news.insnet.cw.net>,
Omri Barel <spammer@b2z.com> wrote:
...
>In the loops solution (seven nested loops), the last variable never
>takes the first value. Translating to cards, it means that you're
>assuming that the last card on the table can never be the ace of spades.
>
>This assumption would change the probabilities considerably (and is
>definitely wrong for a game of poker).
>
>So if you want a call/fold/raise winning probabilities after each card,
>you can't just go through all possible 7-card sets, you have to look at
>the order of the cards in each set as well.
I'm not sure it's quite that bad. Each player starts out with 2 private
cards, and then five public cards are made available in three groups: the
flop (the first 3 cards), the turn (the fourth card), and the river (the
last card). So, the set of 7 cards is made of 4 subsets:
Size Name
===== =====
2 Private (This is unique to each player)
3 Flop
1 Turn
1 River
Within the Private and Flop sets, ordering doesn't matter. This reduces
the search space by a factor of 12.
One complication in all this is that the value of a given set of 7 cards
is strongly influenced by the potential value of the public cards by
themselves. That is, if I'm holding a pair of 2's, they aren't worth
as much if the public cards look like 4,4,3,3,3 or 4,5,6,7,10. I would
expect considerations like those to have a big role in deciding the
overall worth of a hand.
-Mike
--
http://www.mschaef.com
|
|
0
|
|
|
|
Reply
|
mschaef3 (136)
|
10/5/2005 1:24:07 PM
|
|
Roger Willcocks said:
> <bob@coolgroups.com> wrote in message
> news:1128448274.935279.78050@g47g2000cwa.googlegroups.com...
>> Let's say you want to iterate through all of the possible combinations
>> that occur when you choose 7 cards from a fifty two card deck. Anyone
>> know the best way to do this?
>
> Are the same cards, but in a different order, a different combination?
No. They are a different permutation, but he specifically asked for
combinations, not permutations.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/2005
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
|
|
0
|
|
|
|
Reply
|
invalid171 (6556)
|
10/5/2005 11:10:55 PM
|
|
|
9 Replies
35 Views
(page loaded in 0.145 seconds)
|