Beispiel #1
0
        public static bool ReadHands(string pokerHand, Card[] hand1, Card[] hand2)
        {
            string[] linePieces;

            if (string.IsNullOrEmpty(pokerHand))
            {
                return(false);
            }

            linePieces = pokerHand.Split();

            char[] hand1LinePieces = linePieces[0].ToCharArray();
            char[] hand2LinePieces = linePieces[1].ToCharArray();

            for (int i = 0; i < 5; i++)
            {
                hand1[i] = new Card
                {
                    Value = Card.GetCardValue(hand1LinePieces[i].ToString())
                };
            }

            for (int i = 0; i < 5; i++)
            {
                hand2[i] = new Card
                {
                    Value = Card.GetCardValue(hand2LinePieces[i].ToString())
                };
            }

            return(true);
        }