HoldemHand.Hand.UniqueHands C# (CSharp) Method

UniqueHands() public static method

This method returns the number of unique mask values that can be made with ncards, where all of the hands contain the shared cards.
public static UniqueHands ( ulong shared, int ncards ) : long
shared ulong Cards required in all of the hands
ncards int The number of cards in the mask
return long
        public static long UniqueHands(ulong shared, int ncards)
        {
            #if DEBUG
            if (BitCount(shared) > ncards) throw new ArgumentException("mask must contain less cards than ncards");
            #endif
            uint hv = 0U;
            Dictionary<uint, long> dict = new Dictionary<uint, long>();
            foreach (ulong mask in Hand.Hands(shared, 0UL, ncards))
            {
                hv = Hand.Evaluate(mask);
                if (!dict.ContainsKey(hv))
                    dict.Add(hv, 1);
            }
            return dict.Count;
        }