コード例 #1
0
ファイル: Deck.cs プロジェクト: 7aylor/cribrage
 /// <summary>
 /// Really just clears the used cards so that when GetTopRandomCard
 /// is called, it has the full deck to look through
 /// </summary>
 public void Shuffle()
 {
     foreach (Card c in Cards)
     {
         c.IsCutCard = false;
     }
     DealtCardIndexes.Clear();
 }
コード例 #2
0
ファイル: Deck.cs プロジェクト: 7aylor/cribrage
        /// <summary>
        /// Gets a random card from the deck that hasn't been used
        /// </summary>
        /// <returns>Random Card</returns>
        public Card GetTopRandomCard()
        {
            Random rand  = new Random();
            int    index = -1;

            do
            {
                index = rand.Next(Count);
            } while (DealtCardIndexes.Contains(index));

            DealtCardIndexes.Add(index);

            return(Cards[index]);
        }