예제 #1
0
        private bool CheckIfStraight()
        {
            var sortedCards = DealtCards.OrderBy(o => o.CardRank).ToList();

            int rankToCheck = sortedCards[0].CardRank;

            foreach (Card card in sortedCards)
            {
                if (card.CardRank != rankToCheck)
                {
                    return(false);
                }

                rankToCheck++;
            }

            return(true);
        }
예제 #2
0
        private bool CheckIfRoyalFlush()
        {
            var sortedCards = DealtCards.OrderBy(o => o.CardRank).ToList();

            int suitToCheck = sortedCards[0].CardSuit;
            int rankToCheck = 10;

            if (sortedCards[0].CardRank != 1)
            {
                return(false);
            }

            foreach (Card card in sortedCards.Skip(1))
            {
                if (card.CardSuit != suitToCheck || card.CardRank != rankToCheck)
                {
                    return(false);
                }

                rankToCheck++;
            }

            return(true);
        }