コード例 #1
0
        public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards)
        {
            if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() < 2)
            {
                return(false);
            }

            if (HandAnalyzerHelpers.IsPair(playerCards, 1))
            {
                return(false);
            }

            var allCards = HandAnalyzerHelpers.CombineCardLists(boardCards, playerCards);

            if (HandAnalyzerHelpers.IsNofKind(allCards, 3) || HandAnalyzerHelpers.IsNofKind(allCards, 4))
            {
                return(false);
            }

            var pairs = allCards.GroupBy(x => x.RankNumericValue).Where(x => x.Count() == 2);

            if (pairs != null && pairs.Count() > 1)
            {
                var bottomPair = boardCards.Min(x => x.RankNumericValue);
                return(pairs.ElementAt(1).Key == bottomPair &&
                       playerCards.Any(x => x.RankNumericValue == bottomPair) &&
                       !playerCards.Any(x => pairs.First().Key == x.RankNumericValue));
            }

            return(false);
        }
コード例 #2
0
        public bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards)
        {
            if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() < 3)
            {
                return(false);
            }

            var allCards = boardCards.ToList();

            allCards.AddRange(playerCards);

            if (!HandAnalyzerHelpers.IsPair(playerCards, 1) || !HandAnalyzerHelpers.IsNofKind(allCards, 3))
            {
                return(false);
            }

            var bottomBoardCardRank = boardCards.Min(x => x.RankNumericValue);

            if (playerCards.Any(x => x.RankNumericValue == bottomBoardCardRank))
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
        public virtual bool Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards)
        {
            if (playerCards == null || boardCards == null || playerCards.Count() != 2 || boardCards.Count() == 0)
            {
                return(false);
            }

            var allCards = HandAnalyzerHelpers.CombineCardLists(boardCards, playerCards);

            if (HandAnalyzerHelpers.IsPair(playerCards, 1) || !HandAnalyzerHelpers.IsPair(allCards, 1))
            {
                return(false);
            }

            if (playerCards.Any(c => c.RankNumericValue == boardCards.Min(x => x.RankNumericValue)))
            {
                return(true);
            }

            return(false);
        }