zekyll / OMPEval

Fast C++ poker hand evaluator and equity calculator
ISC License
173 stars 69 forks source link

Why Hands doesn't use enumerations #6

Open sk-jame opened 7 years ago

sk-jame commented 7 years ago
// Create a Hand from a card. CardIdx is an integer between 0 and 51, so that CARD = 4 * RANK + SUIT, where
// rank ranges from 0 (deuce) to 12 (ace) and suit is from 0 (spade) to 3 (diamond).

Ok, I could create enums by my own, but which order? spade = 0, hearts, clubs, diamonds

or

spade = 0, clubs, hearts, diamonds

valentino-sm commented 7 years ago
unsigned CardRange::charToSuit(char c)
{
    switch(c) {
        case 's': return 0;
        case 'h': return 1;
        case 'c': return 2;
        case 'd': return 3;
        default: return ~0u;
    }
}

Actually, you can sort suits how you want and nothing will be changed results will be same =D