Beispiel #1
0
        public string BuildSortedHandString()
        {
            string sortedHandString = "(";

            if (MainHand != null && MainHand.CardCount() != 0)
            {
                foreach (Card card in MainHand.GetCards())
                {
                    sortedHandString += String.Format("{0}{1}, ", FriendlyValueNames[card.Value], Constants.FriendlySuitNames[card.Suit]);
                }
                sortedHandString = sortedHandString.Remove(sortedHandString.Length - 2);
            }
            sortedHandString += "), (";
            if (KickerHand != null && KickerHand.CardCount() != 0)
            {
                foreach (Card card in KickerHand.GetCards())
                {
                    sortedHandString += String.Format("{0}{1}, ", FriendlyValueNames[card.Value], Constants.FriendlySuitNames[card.Suit]);
                }
                sortedHandString = sortedHandString.Remove(sortedHandString.Length - 2);
            }
            sortedHandString += ")";

            return(sortedHandString);
        }
Beispiel #2
0
        public bool?IsBetterThanHand(SortedHand secondHand)
        // Compare the main hand and kicker hand of two hands of the same type (e.g. flush, pair, etc...)
        {
            for (int i = 0; i < MainHand.CardCount(); i++)
            {
                if (MainHand.GetCards()[i].Value > secondHand.MainHand.GetCards()[i].Value)
                {
                    return(true);
                }
                else if (MainHand.GetCards()[i].Value < secondHand.MainHand.GetCards()[i].Value)
                {
                    return(false);
                }
            }

            if (KickerHand != null)
            {
                for (int i = 0; i < KickerHand.CardCount(); i++)
                {
                    if (KickerHand.GetCards()[i].Value > secondHand.KickerHand.GetCards()[i].Value)
                    {
                        return(true);
                    }
                    else if (KickerHand.GetCards()[i].Value < secondHand.KickerHand.GetCards()[i].Value)
                    {
                        return(false);
                    }
                }
            }

            return(null);
        }