Ejemplo n.º 1
0
        // Returns a StartingHand representing a generalised form of the hand (i.e. AA, AKs or AKo)
        public static StartingHand FindStartingHand(CardGroup Cards)
        {
            string retVal = "";

            if (Cards[0].RankNumericValue == Cards[1].RankNumericValue)
            {
                return(_hands[Cards[0].Rank + Cards[1].Rank]);
            }
            else if (Cards[0].RankNumericValue > Cards[1].RankNumericValue)
            {
                retVal = Cards[0].Rank + Cards[1].Rank;
            }
            else
            {
                retVal = Cards[1].Rank + Cards[0].Rank;
            }

            retVal += Cards[0].Suit.Equals(Cards[1].Suit) ? "s" : "o";
            return(_hands[retVal]);
        }
        public override bool Equals(object obj)
        {
            bool stringEquality = obj.ToString().Equals(ToString());

            if (stringEquality)
            {
                return(true);
            }

            CardGroup cardGroup = obj as CardGroup;

            if (cardGroup == null)
            {
                return(false);
            }

            if (cardGroup.Cards.Count != Cards.Count)
            {
                return(false);
            }

            return(cardGroup.Cards.All(c => Cards.Contains(c)));
        }