コード例 #1
0
        public Queue<Card> GetListOfWinning(IList<Card> currentHand, CardSuit suit, Queue<Card> q)
        {
            var currentSuitCards = new CardCollection
                                  {
                                      new Card(suit, CardType.Nine),
                                      new Card(suit, CardType.Jack),
                                      new Card(suit, CardType.Queen),
                                      new Card(suit, CardType.King),
                                      new Card(suit, CardType.Ten),
                                      new Card(suit, CardType.Ace),
                                  };
            var cards = this.playedCardsInCurrentContext.Where(x => x.Suit == suit).ToList();
            foreach (var card in cards)
            {
                currentSuitCards.Remove(card);
            }

            currentSuitCards.OrderByDescending(x => x.GetValue()).ToList();
            if (currentSuitCards.Count() > 0)
            {
                if (currentHand.Contains(currentSuitCards.ElementAt(0)))
                {
                    q.Enqueue(currentSuitCards.First());
                }
            }

            return q;
        }