Exemple #1
0
            private bool IsStraight(CardList cards)
            {
                if (cards.AreConsecutive(true, false, 5))
                {
                    return true;
                }

                if (cards.AreConsecutive(false, false, 5))
                {
                    return true;
                }

                return false;
            }
Exemple #2
0
            private bool IsOpenEndedStraightDraw(CardList cardList)
            {
                if (cardList.Count < 4) return false;

                // Except if the ace is the last card, because there's no cards higher than the ace
                if (cardList.AreConsecutive(true, false, 4)){

                    // (list is sorted from lowest to highest)
                    cardList.Sort(SortUsing.AceHigh);

                    // Special case
                    if (cardList[cardList.Count - 1].Face == CardFace.Ace &&
                        cardList[cardList.Count - 2].Face == CardFace.King &&
                        cardList[cardList.Count - 3].Face == CardFace.Queen &&
                        cardList[cardList.Count - 4].Face == CardFace.Jack) return false;
                    else return true;
                }

                // Except if the ace is not the first card, there's no cards lower than the ace

                if (cardList.AreConsecutive(false, false, 4))
                {
                    cardList.Sort(SortUsing.AceLow);

                    // Special case
                    if (cardList[0].Face == CardFace.Ace &&
                        cardList[1].Face == CardFace.Two &&
                        cardList[2].Face == CardFace.Three &&
                        cardList[3].Face == CardFace.Four) return false;
                    else return true;
                }

                return false;
            }
Exemple #3
0
            private bool IsRoyalFlush(CardList cards)
            {
                if (cards.AreConsecutive(true, true, 5))
                {
                    return true;
                }

                if (cards.AreConsecutive(false, true, 5))
                {
                    return true;
                }

                return false;
            }