Esempio n. 1
0
        //---------------------------------------------------------------------
        List <Card> _getFlush()
        {
            bool if_havesame_suit = _ifHaveSameSuitCard();

            if (!if_havesame_suit)
            {
                return(null);
            }

            List <Card> list_card = new List <Card>();
            var         card      = GetNextCard();

            list_card.Add(card);
            CardSuit card_suit   = (CardSuit)card.Suit;
            var      card_second = _getSameSuitCard(card_suit);

            if (card_second == null)
            {
                _giveBackCard(list_card);
                return(null);
            }
            list_card.Add(card_second);

            var card_third = _getSameSuitCard(card_suit);

            if (card_third == null)
            {
                _giveBackCard(list_card);
                return(null);
            }
            list_card.Add(card_third);

            var card_fourth = _getSameSuitCard(card_suit);

            if (card_fourth == null)
            {
                _giveBackCard(list_card);
                return(null);
            }
            list_card.Add(card_fourth);

            var card_last = _getSameSuitCard(card_suit);

            if (card_last == null)
            {
                _giveBackCard(list_card);
                return(null);
            }
            list_card.Add(card_last);

            var hand_rank = CardTypeHelperTexas.GetHandRankHTexas(list_card);

            if (hand_rank == HandRankTypeTexasH.StraightFlush || hand_rank == HandRankTypeTexasH.RoyalFlush)
            {
                _giveBackCard(list_card);
                list_card = _getFlush();
            }

            return(list_card);
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        List <Card> _getStraight()
        {
            List <Card> list_card = new List <Card>();
            var         card      = GetNextCard();

            list_card.Add(card);
            CardType card_type = (CardType)card.Type;
            CardSuit card_suit = (CardSuit)card.Suit;

            if ((card.Type >= ((int)CardType.Jack)) && (card.Type < ((int)CardType.Ace)))
            {
                _getStraightEx(list_card, card_type, card_suit, false, false);
            }
            else if (card_type == CardType.Ace)
            {
                _getStraightEx(list_card, card_type, card_suit, false, false);
                if (list_card.Count <= 1)
                {
                    _getStraightEx(list_card, card_type, card_suit, false, true);
                }
            }
            else
            {
                _getStraightEx(list_card, card_type, card_suit, false, true);
            }

            if (list_card.Count == 0)
            {
                list_card = _getStraight();
            }

            var hand_rank = CardTypeHelperTexas.GetHandRankHTexas(list_card);

            if (hand_rank == HandRankTypeTexasH.StraightFlush || hand_rank == HandRankTypeTexasH.RoyalFlush)
            {
                _giveBackCard(list_card);
                list_card = _getStraight();
            }

            return(list_card);
        }
Esempio n. 3
0
        //---------------------------------------------------------------------
        List <Card> _getHighCard()
        {
            List <Card> list_cards = new List <Card>();

            for (int i = 0; i < NormalCardsCount; i++)
            {
                var card = GetNextCard();
                list_cards.Add(card);
            }

            var hand_rank = CardTypeHelperTexas.GetHandRankHTexas(list_cards);

            if (hand_rank != HandRankTypeTexasH.HighCard)
            {
                foreach (var i in list_cards)
                {
                    _giveBackCard(i);
                }

                list_cards = _getHighCard();
            }

            return(list_cards);
        }