예제 #1
0
        private void ShuffleIfNeeded()
        {
            // Check if we need to reshuffle
            double currentCardsLeft   = deck.CardsLeft();
            double currentPenetration = 1 - (currentCardsLeft / initialDeckSize);

            if (currentPenetration > penetrationAsDouble)
            {
                roundsPlayed++; // TODO bugge
                totalCardsDealt += deck.CardsLeft();
                deck.ShuffleDeck();
                foreach (Player player in players)
                {
                    player.ResetCount();
                }
            }
        }
예제 #2
0
        public BlackJackGame(IList <Player> players, Deck deck, double penetrationPercent)
        {
            this.players = players;

            initialDeckSize     = deck.CardsLeft();
            penetrationAsDouble = penetrationPercent / 100;

            dealer    = new Dealer(new DealerStrategy());
            this.deck = deck;
            dealer.SetDeck(deck);

            foreach (Player player in players)
            {
                player.SetDeck(deck);
            }
        }