public static string DescriptionFromMask(ulong cards, uint handvalue) { int numberOfCards = BitCount(cards); #if DEBUG // This functions supports 1-7 cards if (numberOfCards < 1 || numberOfCards > 7) { throw new ArgumentOutOfRangeException("numberOfCards"); } #endif // Seperate out by suit uint sc = (uint)((cards >> (CLUB_OFFSET)) & 0x1fffUL); uint sd = (uint)((cards >> (DIAMOND_OFFSET)) & 0x1fffUL); uint sh = (uint)((cards >> (HEART_OFFSET)) & 0x1fffUL); uint ss = (uint)((cards >> (SPADE_OFFSET)) & 0x1fffUL); switch ((HandType)GetHandType(handvalue)) { case HandType.HighCard: case HandType.Pair: case HandType.TwoPair: case HandType.Trips: case HandType.Straight: case HandType.FullHouse: case HandType.FourOfAKind: return(DescriptionFromHandValueInternal(handvalue)); case HandType.Flush: if (ss.BitCount() >= 5) { return("Flush (Spades) with " + ranktbl[TopCard(handvalue)] + " high"); } else if (sc.BitCount() >= 5) { return("Flush (Clubs) with " + ranktbl[TopCard(handvalue)] + " high"); } else if (sd.BitCount() >= 5) { return("Flush (Diamonds) with " + ranktbl[TopCard(handvalue)] + " high"); } else if (sh.BitCount() >= 5) { return("Flush (Hearts) with " + ranktbl[TopCard(handvalue)] + " high"); } break; case HandType.StraightFlush: if (ss.BitCount() >= 5) { return("Straight Flush (Spades) with " + ranktbl[TopCard(handvalue)] + " high"); } else if (sc.BitCount() >= 5) { return("Straight (Clubs) with " + ranktbl[TopCard(handvalue)] + " high"); } else if (sd.BitCount() >= 5) { return("Straight (Diamonds) with " + ranktbl[TopCard(handvalue)] + " high"); } else if (sh.BitCount() >= 5) { return("Straight (Hearts) with " + ranktbl[TopCard(handvalue)] + " high"); } break; } return(""); }