Пример #1
0
 public Deck(IDeckDescriptor <T> config)
 {
     _disposed    = false;
     _cards       = new List <T>(config.DeckSize);
     _shuffleData = new byte[1000];
     _rng         = new RNGCryptoServiceProvider();
     BuildDeck(config.CardCounts, config.FillerCard);
 }
Пример #2
0
        public static double Simulate <T>(IDeckDescriptor <T> des)
        {
            int successCount = 0;

            using (IDeck <T> deck = new Deck <T>(des))
            {
                IHand <T> hand = new Hand <T>(deck);

                for (int i = 0; i < des.IterationCount; i++)
                {
                    hand.Reset();
                    deck.Shuffle();

                    if (des.HasCombo(hand))
                    {
                        successCount++;
                    }
                }
            }

            return(100.0 * successCount / des.IterationCount);
        }