I want to create a lookup table for the combinations of poker hands. There are 113million different possible hand combinations in a 7 card board.
If I give each card a number say (1-52) and want to store each possible combination in the table, what would be the best way to go about doing it? I want it to be fast to lookup, so that if I have a hand 13,18,1,51,38,8,49 I can search for the row in the table.
I could store each card in it's own column like so:
poker_hands (id, card1, card2, card3, card4, card5, card6, card7)
or I could perhaps create some sort of hash value for the 7 cards like:
$string= md5($card1 . $card2 . $card3 . $card4 . $card5 . $card6. $card7);
Then use that to lookup the hand
poker_hands (id, hash)
(I'll be storing information about the rank of each hand in the database too; but for now I just want to know the best way of creating a lookup table.)