Beispiel #1
0
        public static HandRange Parse(string handsString)
        {
            string[]  hands     = handsString.Split(',');
            HandRange handRange = new HandRange();

            foreach (string hand in hands)
            {
                string trimedHand = hand.Trim();
                if (StartingHand.AllStartingHands.ContainsKey(trimedHand))
                {
                    handRange.AddRange(StartingHand.AllStartingHands[trimedHand]);
                }
                else if (trimedHand.EndsWith("+"))
                {
                    ParseRange(trimedHand);
                }
                else if (trimedHand.Contains("-"))
                {
                    string[] endHands = trimedHand.Split('-');
                    ParseRange(endHands[0].Trim(), Card.GetRankNumericValue(endHands[1].Trim().Substring(1, 1)));
                }
            }

            return(handRange);
        }
Beispiel #2
0
        public static HandRange AllHands()
        {
            HandRange range = new HandRange();

            foreach (StartingHand hand in StartingHand.AllStartingHands.Values)
            {
                range.AddRange(hand);
            }
            return(range);
        }
Beispiel #3
0
        private static HandRange ParseRange(string startHand, int endRank = (int)Card.CardValueEnum._A)
        {
            HandRange             range = new HandRange();
            Func <string, string> genhand;

            if (startHand[0] == startHand[1])
            {
                genhand = rank => rank + rank;
            }
            else
            {
                genhand = rank => startHand[0] + rank + startHand[2];
            }

            for (int rank = Card.GetRankNumericValue(startHand.Substring(1, 1)); rank <= endRank; ++rank)
            {
                range.AddRange(StartingHand.AllStartingHands[genhand(((Card.CardValueEnum)rank).ToString())]);
            }

            return(range);
        }