示例#1
0
        /// <summary>
        /// Initiates the gameplay by establishing the first drawn card as the designated trump suit,
        /// dealing 6 cards to each player, and declaring the first player to attack
        /// based on which player possesses the lowest ranking trump card
        /// </summary>
        /// ***TODO: Determine first attacker based on lowest trump card in initial hand
        /// (rather than assume the player is always the attacked off the bat)***
        private void StartGame()
        {
            cbxDeck.FaceUp = false;
            // shuffle
            mainDeck.Shuffle();

            // seeing the order of the deck in debug console for debugging
            //mainDeck.ShowDeck(); // This shows all cards, turn this off when done development
            System.Diagnostics.Debug.WriteLine(mainDeck.ToString());
            try
            {
                // The 14th card will be the trump
                cbxTrumpCard.Card = mainDeck.GetCard(13);
                System.Diagnostics.Debug.WriteLine(cbxTrumpCard.Card.ToString());
                PlayingCard.trumpSuit = cbxTrumpCard.Card.Suit;

                InitialDeal();

                PlayingCard firstCard = mainDeck.DrawCard();

                cbxTrumpCard.Card = firstCard; // Moving the trump card to bottom

                // add the trump card back but at the last place in the deck
                mainDeck.AddCardAtBottom(firstCard);
            }
            catch (IndexOutOfRangeException)
            {
                System.Diagnostics.Debug.WriteLine("Exception caught when trying to draw card out of index.");
            }
        }