Пример #1
0
        public static int GetPoints(BasePlayersClass player)
        {
            int points = 0;

            foreach (Card card in player.Cards)
            {
                points += CardServ.GetCardValue(card);
            }

            return(points);
        }
Пример #2
0
        static Shoes Initialize(Shoes shoes, short quantity)
        {
            //shoes = new Stack<Card>(CARDSINDECK * decksNo);
            List <Card> pack = new List <Card>(CARDSINDECK * quantity);

            for (int i = (int)CardSuit.Hearts; i <= (int)CardSuit.Spades; i++)
            {
                for (int j = (int)CardName.TWO; j <= (int)CardName.TEN; j++)
                {
                    pack.Insert(new Random().Next(0, pack.Count), CardServ.CreateACard((CardName)j, (CardSuit)i));
                }

                pack.Insert(new Random().Next(0, pack.Count), CardServ.CreateACard(CardName.K, (CardSuit)i));
                pack.Insert(new Random().Next(0, pack.Count), CardServ.CreateACard(CardName.J, (CardSuit)i));
                pack.Insert(new Random().Next(0, pack.Count), CardServ.CreateACard(CardName.Q, (CardSuit)i));
                pack.Insert(new Random().Next(0, pack.Count), CardServ.CreateACard(CardName.A, (CardSuit)i));
            }

            for (int i = 0; i < CARDSINDECK; i++)
            {
                int r    = new Random().Next(0, CARDSINDECK);
                var buff = pack[i];
                pack[i] = pack[r];
                pack[r] = buff;
            }

            for (int i = 0; i < CARDSINDECK; i++)
            {
                int r = new Random().Next(0, pack.Count - 1);
                shoes.Decks.Push(pack.ElementAt(r));
                pack.RemoveAt(r);
            }

            return(shoes);


            //foreach (var item in shoes) Console.Write(item.ToString() + " "); Console.ReadKey();
        }