Ejemplo n.º 1
0
        private static List <int> FillBits(byte byt)
        {
            var result = new List <int>();
            var bits   = new Stack <int>();

            for (var index = 0; index < 8; index++)
            {
                bits.Push(byt % 2);
                byt /= 2;
            }

            return(bits.ToList());
        }
Ejemplo n.º 2
0
        public void FillandShuffleDeck()
        {
            foreach (var n in Enum.GetValues(typeof(Nominal)))
            {
                foreach (var s in Enum.GetValues(typeof(Suit)))
                {
                    cards.Push(new Card((Nominal)n, (Suit)s));
                }
            }
            var rand   = new Random();
            var cardsL = cards.ToList <Card>();

            for (var j = cardsL.Count - 1; j > 0; j--)
            {
                var i = rand.Next(j);
                var t = cardsL[i];
                cardsL[i] = cardsL[j];
                cardsL[j] = t;
            }
            cards = new Stack <Card>(cardsL);
        }