예제 #1
0
        /// <summary>
        /// Demonstrates use of Deck and Card objects
        /// </summary>
        /// <param name="args">command-line args</param>
        static void Main(string[] args)
        {
            // create a new deck and print the contents of the deck
            Deck deck = new Deck();

            #region EmptyTest
            // test if empty
            Console.WriteLine("Empty: " + deck.Empty);
            #endregion

            #region Shuffle
            // shuffle the deck and print the contents of the deck
            Console.WriteLine("------------Pre Shuffle------------");
            deck.Print();
            Console.WriteLine("------------Shuffle 1------------");
            deck.Shuffle();
            deck.Print();
            #endregion

            #region Cut
            // take the top card from the deck and print the card rank and suit
            Console.WriteLine("------------CUT------------");
            deck.Cut(26);
            deck.Print();
            #endregion

            #region TakeTopCard
            // take the top card from the deck and print the card rank and suit
            Card card = deck.TakeTopCard();
            Console.WriteLine("------------Take Top Card------------");
            Console.WriteLine(card.Rank + " of " + card.Suit);
            #endregion

        }
예제 #2
0
        static void Main(string[] args)
        {
            ///print the deck cards in the order they are
            Deck deck = new Deck();
            deck.Print();

            ///clear the console
            Console.Clear();

            ///shuffle the deck and then print it again
            deck.Shuffle();
            deck.Print();

            Console.Clear();

            // take the top card from the deck and print the card rank and suit

            // take the top card from the deck and print the card rank and suit
        }
        /// <summary>
        /// Demonstrates use of Deck and Card objects
        /// </summary>
        /// <param name="args">command-line args</param>
        static void Main(string[] args)
        {
            // create a new deck and print the contents of the deck
            Deck deck = new Deck();

            // shuffle the deck and print the contents of the deck
            deck.Shuffle();
            deck.Print();

            Console.WriteLine();

            // take the top card from the deck and print the card rank and suit
            Card topCard = deck.TakeTopCard();

            Console.WriteLine("Top card: " + topCard.Rank + " of " + topCard.Suit + ".");
            Console.WriteLine();

            // take the top card from the deck and print the card rank and suit
            topCard = deck.TakeTopCard();

            Console.WriteLine("Top card: " + topCard.Rank + " of " + topCard.Suit + ".");
            Console.WriteLine();
        }
예제 #4
0
        static void Main(string[] args)
        {
            // create a new deck and print the contents of the deck

            Deck x = new Deck();
            x.Print();

            // shuffle the deck and print the contents of the deck

            Console.WriteLine();
            x.Shuffle();
            x.Print();

            // take the top card from the deck and print the card rank and suit

            Card c = x.TakeTopCard();
            Console.WriteLine(c.Rank);

            // take the top card from the deck and print the card rank and suit

            c = x.TakeTopCard();
            Console.WriteLine("Rank: " + c.Rank);
            Console.WriteLine("Suit: " + c.Suit);
        }