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); }
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); }