// This one is not fully optimized PokerEvaluation CardSet::evaluateSuitsLow2to7() const { PokerEvaluation high; // if there are five or fewer cards, we just evaluate the high, // fix the wheel, and take the complement switch (size()) { case 0: case 1: case 2: case 3: case 4: high = evaluateHighFlush(); break; case 5: high = evaluateHighFlush(); high.fixWheel2to7(rankMask()); break; default: // this is a slow way to handle the general case. // TODO: specialize the code for the 6 and 7 card cases. vector<Card> cards = this->cards(); combinations combo(size(), FULL_HAND_SIZE); PokerEvaluation best; do { CardSet candidate; for (size_t i=0; i<static_cast<size_t>(FULL_HAND_SIZE); i++) candidate.insert(cards[combo[i]]); PokerEvaluation e = candidate.evaluateSuitsLow2to7(); if (e > best) best = e; } while (combo.next()); return best; } high.flip(); return high; }