HoldemHand.Hand.FlushDrawCount C# (CSharp) Method

FlushDrawCount() public static method

Counts the number of hands that are a flush with one more drawn card.
public static FlushDrawCount ( ulong mask, ulong dead ) : int
mask ulong Hand
dead ulong Cards not allowed to be drawn
return int
        public static int FlushDrawCount(ulong mask, ulong dead)
        {
            int retval = 0;

            // Get original mask value
            Hand.HandTypes handtype = Hand.EvaluateType(mask);

            // If current mask better than a straight return then 0 outs
            if (handtype >= Hand.HandTypes.Flush)
                return retval;

            // Look ahead one card
            foreach (ulong card in Hand.Hands(0UL, mask | dead, 1))
            {
                // Get new mask value
                Hand.HandTypes handType = Hand.EvaluateType(mask | card);

                // Include straight flush as this will ensure outs is always the maximum
                if (handType == Hand.HandTypes.Flush || handType == Hand.HandTypes.StraightFlush)
                {
                    retval++;
                }
            }

            return retval;
        }

Same methods

Hand::FlushDrawCount ( ulong player, ulong board, ulong dead ) : int