示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }