Open
Description
An alternate implementation to either add or replace the current one
I implemented a poker calculator many years ago, here are some things that I learned.
You can get excellent performance by representing cards as bits. A hand can be composed of 4 u13, each one representing one suit. Bit 0 represents card 2 and bit 12 represents an Ace. Testing for a flush can be done by checking if the pop count of a suit is at least 5. Testing for a straight can be done by or’ing all suits and checking if the set bits are contiguous. Checking for a pair can be done by and’ing each pair of suits and checking if any of these is different from 0
Metadata
Metadata
Assignees
Labels
No labels