Example #1
0
            private PairType GetPairType(CardList communityCards, Card matching, Card firstCard, Card secondCard)
            {
                communityCards.Sort(SortUsing.AceHigh);

                // Pocket pair
                if (firstCard.Face == secondCard.Face)
                {
                    if (firstCard.GetFaceValue() >= communityCards.Last.GetFaceValue())
                    {
                        return(PairType.Top);
                    }
                    else if (firstCard.GetFaceValue() <= communityCards[0].GetFaceValue())
                    {
                        return(PairType.Bottom);
                    }
                    else
                    {
                        return(PairType.Middle);
                    }
                }
                else
                {
                    // Matched the board
                    if (matching.Face == communityCards.Last.Face)
                    {
                        return(PairType.Top);
                    }
                    else if (matching.Face == communityCards[0].Face)
                    {
                        return(PairType.Bottom);
                    }
                    else
                    {
                        return(PairType.Middle);
                    }
                }
            }
Example #2
0
        /* In hold'em we don't really care whether we have Kh 6h or Kc 6c,
         * they can both be referred to as K6s (king-six suited) */
        public override string ToString()
        {
            Card firstCard  = GetFirstCard();
            Card secondCard = GetSecondCard();

            CardSuit firstSuit  = firstCard.Suit;
            CardSuit secondSuit = secondCard.Suit;

            CardFace firstFace  = firstCard.Face;
            CardFace secondFace = secondCard.Face;

            // Swap them so that the bigger card is echoed first (A6 instead of 6A)
            if (firstCard.GetFaceValue() < secondCard.GetFaceValue())
            {
                CardFace t = firstFace;
                firstFace  = secondFace;
                secondFace = t;
            }

            return(ConvertToString(firstFace, firstSuit, secondFace, secondSuit));
        }
Example #3
0
            private PairType GetPairType(CardList communityCards, Card matching, Card firstCard, Card secondCard)
            {
                communityCards.Sort(SortUsing.AceHigh);

                // Pocket pair
                if (firstCard.Face == secondCard.Face)
                {
                    if (firstCard.GetFaceValue() >= communityCards.Last.GetFaceValue()) return PairType.Top;
                    else if (firstCard.GetFaceValue() <= communityCards[0].GetFaceValue()) return PairType.Bottom;
                    else return PairType.Middle;
                }
                else
                {
                    // Matched the board
                    if (matching.Face == communityCards.Last.Face) return PairType.Top;
                    else if (matching.Face == communityCards[0].Face) return PairType.Bottom;
                    else return PairType.Middle;
                }
            }