HoldemHand.Hand.StraightDrawCount C# (CSharp) Method

StraightDrawCount() public static method

The method returns the number of straight draws that are possible for the current mask.
public static StraightDrawCount ( ulong mask, ulong dead ) : int
mask ulong Current Hand
dead ulong Dead cards
return int
        public static int StraightDrawCount(ulong mask, ulong dead)
        {
            int retval = 0;

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

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

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

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

            return retval;
        }

Same methods

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