wannabemathguy
wannabemathguy
  • Threads: 1
  • Posts: 3
Joined: Oct 12, 2012
October 12th, 2012 at 7:24:39 PM permalink
I wanted to try out the method as described on the wizard of odds site, and there are 4 functions at the bottom of the page that are meant to be used for calculating an array index given a certain number of card values:

I was testing the HandIndex4 routine, when I came across this oddity:

This combination of cards: 0 13 26 39 (for cards 2C 2D 2H 2S - a FOUR OF A KIND) returns an array index of 12076.

And, this combination also returns 12076: 0 13 27 15 (for cards 2C 2D 3H 4D - a PAIR).

Am I reading the function incorrectly? I was assuming that I would get a unique index number for each possible unique hand and was surprised when I came up with a duplicate.

Has anyone else used this function and might be able to shed some light on this?

Thanks
CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
October 12th, 2012 at 9:23:29 PM permalink
The hands must me sorted first.
I heart Crystal Math.
wannabemathguy
wannabemathguy
  • Threads: 1
  • Posts: 3
Joined: Oct 12, 2012
October 12th, 2012 at 11:12:59 PM permalink
Quote: CrystalMath

The hands must me sorted first.



Are you sure? The reason I question that is because looping through the 2,598,960 combinations requires taking subsets of each of those hands and getting an index based on that subset of cards.

This hand, AC AD 3C 3D KS (12 25 1 14 50), is different than this hand, 3C 3D AC AD KS (1 14 12 15 50) with respect to the card value order of the cards, even though the evaluation of the hand would be the same, when looping through the ~2.6 million combinations (not the ~134K unique hands...that comes later).

As far as I'm aware these aren't supposed to be sorted. If they were sorted, they would be the same, and that would defeat the goal of getting all the different combinations on the draw which leads to the original problem of not having a unique index for the 2C 2D 2H 2S subset and the 2C 2D 3H 4D subset when looping through the ~2.6 million combinations.

Or have I completely missed the boat with all of this?
MathExtremist
MathExtremist
  • Threads: 88
  • Posts: 6526
Joined: Aug 31, 2010
October 12th, 2012 at 11:21:52 PM permalink
Quote: wannabemathguy

Are you sure? The reason I question that is because looping through the 2,598,960 combinations requires taking subsets of each of those hands and getting an index based on that subset of cards.

This hand, AC AD 3C 3D KS (12 25 1 14 50), is different than this hand, 3C 3D AC AD KS (1 14 12 15 50) with respect to the card value order of the cards, even though the evaluation of the hand would be the same, when looping through the ~2.6 million combinations (not the ~134K unique hands...that comes later).

As far as I'm aware these aren't supposed to be sorted. If they were sorted, they would be the same, and that would defeat the goal of getting all the different combinations on the draw which leads to the original problem of not having a unique index for the 2C 2D 2H 2S subset and the 2C 2D 3H 4D subset when looping through the ~2.6 million combinations.

Or have I completely missed the boat with all of this?


No, AC AD 3C 3D KS and 3C 3D AC AD KS are two different permutations of the same hand. If you consider permutations rather than combinations, there are 52P5 = 311,875,200 of them, and you don't want to do that. You could, but it's just redundant.

Sort the cards in each hand (or partial hand) by card index and everything should work. Or some other sort order, just as long as its consistent.
"In my own case, when it seemed to me after a long illness that death was close at hand, I found no little solace in playing constantly at dice." -- Girolamo Cardano, 1563
JB
Administrator
JB
  • Threads: 334
  • Posts: 2089
Joined: Oct 14, 2009
October 13th, 2012 at 12:09:58 AM permalink
The card numbers need to be sorted. Do not use 0,13,27,15; use 0,13,15,27.
wannabemathguy
wannabemathguy
  • Threads: 1
  • Posts: 3
Joined: Oct 12, 2012
October 13th, 2012 at 5:08:46 PM permalink
Thanks. I'll give this a try.
  • Jump to: