示例#1
0
        static List <Trump> Pattern1(int size)
        {
            var output = new List <Trump>();
            //var deck = Trump.GetDeck();
            var deck         = Trump.GetLargeDeck(size);
            var spadeCards   = new List <Trump>();
            var heartCards   = new List <Trump>();
            var diamondCards = new List <Trump>();
            var clubCards    = new List <Trump>();

            foreach (var card in deck)
            {
                switch (card.Mark)
                {
                case Mark.Spade:
                    spadeCards.Add(card);
                    break;

                case Mark.Heart:
                    heartCards.Add(card);
                    break;

                case Mark.Diamond:
                    diamondCards.Add(card);
                    break;

                case Mark.Club:
                    clubCards.Add(card);
                    break;
                }
            }
            spadeCards   = spadeCards.OrderBy(_ => _.Number).ToList <Trump>();
            heartCards   = heartCards.OrderBy(_ => _.Number).ToList <Trump>();
            diamondCards = diamondCards.OrderBy(_ => _.Number).ToList <Trump>();
            clubCards    = clubCards.OrderBy(_ => _.Number).ToList <Trump>();

            output.AddRange(spadeCards);
            output.AddRange(heartCards);
            output.AddRange(diamondCards);
            output.AddRange(clubCards);

            return(output);
        }
示例#2
0
        static List <Trump> Pattern2(int size)
        {
            var output = new List <Trump>();
            //var deck = Trump.GetDeck();
            var deck = Trump.GetLargeDeck(size);

            var blackCards = new List <Trump>();
            var redCards   = new List <Trump>();

            var spadeCards   = new List <Trump>();
            var heartCards   = new List <Trump>();
            var diamondCards = new List <Trump>();
            var clubCards    = new List <Trump>();

            foreach (var card in deck)
            {
                switch (card.Color)
                {
                case Color.Black:
                    blackCards.Add(card);
                    break;

                case Color.Red:
                    redCards.Add(card);
                    break;
                }
            }

            foreach (var card in blackCards)
            {
                switch (card.Mark)
                {
                case Mark.Spade:
                    spadeCards.Add(card);
                    break;

                case Mark.Club:
                    clubCards.Add(card);
                    break;
                }
            }

            foreach (var card in redCards)
            {
                switch (card.Mark)
                {
                case Mark.Diamond:
                    diamondCards.Add(card);
                    break;

                case Mark.Heart:
                    heartCards.Add(card);
                    break;
                }
            }

            spadeCards   = spadeCards.OrderBy(_ => _.Number).ToList <Trump>();
            heartCards   = heartCards.OrderBy(_ => _.Number).ToList <Trump>();
            diamondCards = diamondCards.OrderBy(_ => _.Number).ToList <Trump>();
            clubCards    = clubCards.OrderBy(_ => _.Number).ToList <Trump>();

            return(output);
        }