Computing unique index for every poker starting hand

Posted by Aly on Stack Overflow See other posts from Stack Overflow or by Aly
Published on 2010-03-15T23:39:28Z Indexed on 2010/03/15 23:39 UTC
Read the original article Hit count: 373

Filed under:
|
|
|

As there are 52 cards in a deck we know there are 52 choose 2 = 1326 distinct matchups, however in preflop poker this can be bucketed into 169 different hands such as AK offsuit and AK suited as whether it is A hearts K hearts or A spade K spades it makes no difference preflop. My question is, is there a nice mathematical property in which I can uniquely index each of these 169 hands (from 0 to 168 preferably). I am trying to create a look up table as a double[][] = new double [169][169] but have no way of changing a hand representation such as AKs (an Ace and a King of the same suit) to a unique index in this array.

© Stack Overflow or respective owner

Related posts about poker

Related posts about lookup-tables