Beispiel #1
0
        public override Maybe <Hand> IsMatch(IEnumerable <Card> cards)
        {
            ThrowIfDuplicate(cards);

            if (cards.Count() < 5)
            {
                return(Maybe <Hand> .None);
            }

            List <Card> cardsInSuit = HandHelper.GetSuitedCards(cards, 5, true);

            if (cardsInSuit.Count < 5)
            {
                return(Maybe <Hand> .None);
            }

            List <Card> straightFlushCards = HandHelper.ResolveStraight(cardsInSuit);

            if (straightFlushCards.Count != 5)
            {
                return(Maybe <Hand> .None);
            }

            return(CreateCopy <Hand>(straightFlushCards));
        }
Beispiel #2
0
        public override Maybe <Hand> IsMatch(IEnumerable <Card> cards)
        {
            ThrowIfDuplicate(cards);

            if (cards.Count() < 5)
            {
                return(Maybe <Hand> .None);
            }

            List <Card> cardsInSuit = HandHelper.GetSuitedCards(cards);

            if (cardsInSuit.Count != 5)
            {
                return(Maybe <Hand> .None);
            }

            return(CreateCopy <Hand>(cardsInSuit));
        }