We don't bite newbies here... much | |
PerlMonks |
Re: Optimising combinatorial iterations by filtrationby YuckFoo (Abbot) |
on Mar 08, 2007 at 22:54 UTC ( [id://603907]=note: print w/replies, xml ) | Need Help?? |
Maybe this will help you generate a lookup table. The number of truly different five card poker hands is not that large. Brute force is good enough to list all 7462 of them. First, forget about suits, and generate all combinations of ranks. Sort them and join them in a string. Count the number of unique ranks in the hand. If it is one, the combination is no good (five aces). If it is five, a flush is possible. Rank all hands from 0..7461 and you have a quick lookup.
Update: YuckFold
In Section
Seekers of Perl Wisdom
|
|