private bool ItIsAStraight() { bool result = true; Card currentCard = OrganizedCardsInHand.First(); for (int i = 1; i < OrganizedCardsInHand.Count; i++) { if (result == true && currentCard.getValueOfCard() - OrganizedCardsInHand[i].getValueOfCard() == 1) { result = true; currentCard = OrganizedCardsInHand[i]; } else if (result == true && OrganizedCardsInHand[i].rank == "A") { if (OrganizedCardsInHand.First().getValueOfCard() - OrganizedCardsInHand[i].getValueOfCard() == 12) { result = true; } } else { result = false; } } return(result); }
public Hand(Array HandAsArray) { foreach (string item in HandAsArray) { CardsInHand.Add(new Card(item)); } while (CardsInHand.Count != 0) { Card card = CardsInHand[0]; foreach (Card cardInner in CardsInHand) { if (card.getValueOfCard() < cardInner.getValueOfCard()) { card = cardInner; } } OrganizedCardsInHand.Add(card); CardsInHand.Remove(card); } }