Пример #1
0
        /// <summary>
        /// Tries to create a Two of a Kind <see cref="Hand"/> from the given cards.
        /// </summary>
        /// <param name="cards">The cards from which to create the hand.</param>
        /// <returns>
        ///	a Two of a Kind hand, or null if the provided cards do not contain the specific hand.
        /// </returns>
        protected override Hand GetBestHandOverride(List <Card> cards)
        {
            List <Card> pair = NofAKindFamily.GetHighestCards(cards, 2);

            if (pair != null)
            {
                IEnumerable <Card> highCards = NofAKindFamily.GetHighCards(cards, pair);
                return(new TwoOfAKindHand(pair, highCards, this));
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// Tries to create a Four of a Kind <see cref="Hand"/> from the given cards.
        /// </summary>
        /// <param name="cards">The cards from which to create the hand.</param>
        /// <returns>
        ///	a Four of a Kind hand, or null if the provided cards do not contain the specific hand.
        /// </returns>
        protected override Hand GetBestHandOverride(List <Card> cards)
        {
            List <Card> foursom = NofAKindFamily.GetHighestCards(cards, 4);            // get the four of a kind

            if (foursom != null)
            {
                // gets the rest of the cards in the hand
                IEnumerable <Card> highCards = NofAKindFamily.GetHighCards(cards, foursom);
                return(new FourOfAKindHand(foursom, highCards, this));
            }
            return(null);
        }
Пример #3
0
        /// <summary>
        /// Tries to create a Three of a Kind <see cref="Hand"/> from the given cards.
        /// </summary>
        /// <param name="cards">The cards from which to create the hand.</param>
        /// <returns>
        ///	a Three of a Kind hand, or null if the provided cards do not contain the specific hand.
        /// </returns>
        protected override Hand GetBestHandOverride(List <Card> cards)
        {
            List <Card> triplet = NofAKindFamily.GetHighestCards(cards, 3); // get the three of a kind

            if (triplet != null)
            {
                // gets the rest of the cards in the hand
                IEnumerable <Card> highCards = NofAKindFamily.GetHighCards(cards, triplet);
                return(new ThreeOfAKindHand(triplet, highCards, this));
            }
            return(null);
        }