示例#1
0
        public void DealsAllCardsFromDeck()
        {
            Player dealer = GetDealer();

            while (!_deck.IsEmpty())
            {
                _ps.DealsCards(_deck.Pop(DealingRules.NbCardsToDeal), NextPlayer());
                SendCardsToAside(PickCardsForAside(_deck, CountAside()));
            }

            ResetRoundNumber();
        }
示例#2
0
        private IEnumerable <Card> PickCardsForAside(TarotDeck tarotDeck, int asideCardsCount)
        {
            int nbRemainingCardsForAside = _rules.AsideMaxCards(NbPlayers()) - asideCardsCount;

            if (nbRemainingCardsForAside > 0)
            {
                Random rnd = new Random();
                int    rndNbCardsToSend = rnd.Next(1, DealingRules.NbCardsToDeal) + 1;

                return(tarotDeck.Pop(Math.Min(rndNbCardsToSend, nbRemainingCardsForAside)));
            }
            else
            {
                return(null);
            }
        }