Class to represent a deck of cards, or a hand of cards, or any other collection of cards used in the game. I.e. the dealer's deck, or a stack of cards in a solitairre game, or a discard pile.
Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            _dealer = new Deck(new Game());
        }
Example #2
0
        public DeckShape GetDeckShape(Deck deck)
        {
            for (int i = 0; i < DeckShapes.Count; i++)
            {
                if (DeckShapes[i].Deck == deck)
                    return DeckShapes[i];
            }

            return null;
        }
Example #3
0
        private void Start_Click(object sender, RoutedEventArgs e)
        {
            _dealer = new Deck(1, 13, GameShape.Game);

            _dealer.Shuffle(5);
            _dealer.MakeAllCardsDragable(false);
            _dealer.Enabled = true;
            _dealer.FlipAllCards();

            var pbn = Pbn.Text;

            // collection cards if any are out
            if (_dealer.Cards.Count < 52)
            {
                CollectCards();
            }
            _dealer.Shuffle(5);

            // deal 13 cards to each of the four players
            for (var cardCount = 0; cardCount < CardsPerPlayer; cardCount++)
            {
                _dealer.Draw(Player1Hand.Deck, 1);
                _dealer.Draw(Player2Hand.Deck, 1);
                _dealer.Draw(Player3Hand.Deck, 1);
                _dealer.Draw(Player4Hand.Deck, 1);
            }

            // turn over human player [4] hand
            Player4Hand.Deck.Sort();
            Player4Hand.Deck.MakeAllCardsDragable(true);
            Player4Hand.Deck.FlipAllCards();
        }
Example #4
0
 /// <summary>
 /// Draws/Moves the specified amount of cards to the specified deck.
 /// </summary>
 /// <param name="toDeck">To deck.</param>
 /// <param name="count">The count.</param>
 public void Draw(Deck toDeck, int count)
 {
     for (var i = 0; i < count; i++)
     {
         TopCard.Deck = toDeck;
     }
 }