Пример #1
0
        //---------------------------------------------------------------------
        List <Card> _getJinNiu()
        {
            var need_cards = mapSameTypeCard.Where(x => x.Key > CardTypeNiuNiu.Ten);

            if (need_cards == null || need_cards.Count() == 0)
            {
                return(null);
            }

            List <Card> list_card = new List <Card>();

            foreach (var i in need_cards)
            {
                list_card.AddRange(i.Value);
            }

            if (list_card.Count < 5)
            {
                return(null);
            }

            list_card = list_card.Shuffle(RandomEx).ToList();
            list_card = list_card.GetRange(0, 5);
            var hand_rank = CardTypeHelperNiuNiu.GetHandRank(list_card);

            if (hand_rank == HandRankTypeNiuNiu.SiZha)
            {
                _giveBackCard(list_card);
                list_card = _getJinNiu();
            }

            foreach (var i in list_card)
            {
                _removeCard(i);
            }

            return(list_card);
        }
Пример #2
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 best_hand = CardTypeHelperNiuNiu.GetBestHand(list_cards);

            if (best_hand.RankType != HandRankTypeNiuNiu.HighCard)
            {
                foreach (var i in list_cards)
                {
                    _giveBackCard(i);
                }

                list_cards = _getHighCard();
            }

            return(list_cards);
        }