/// <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();

            deck.Print();

            Console.WriteLine();

            // 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 card = deck.TakeTopCard();

            Console.WriteLine(card.Rank);
            Console.WriteLine(card.Suit);
            Console.WriteLine();

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

            Console.WriteLine(card2.Rank);
            Console.WriteLine(card2.Suit);
            Console.WriteLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            // create a new deck and print the contents of the deck
            Console.WriteLine("----- A New deck -----");
            Deck deck = new Deck();

            deck.Print();
            Console.WriteLine();
            // shuffle the deck and print the contents of the deck
            Console.WriteLine("----- Shuffle & print -----");
            deck.Shuffle();
            deck.Print();
            Console.WriteLine();
            // take the top card from the deck and print the card rank and suit
            Console.WriteLine("----- take the top card & print -----");
            Card card = deck.TakeTopCard();

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

            // take the top card from the deck and print the card rank and suit
            Console.WriteLine("----- take another top card & print -----");
            card = deck.TakeTopCard();
            Console.WriteLine(card.Rank + " of " + card.Suit);
            Console.WriteLine();
        }
Example #3
0
        /// <summary>
        /// Implements Lab 4 functionality
        /// </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();

            Console.WriteLine("========================================================");
            Console.WriteLine("=============Deck before shuffle...======================");
            Console.WriteLine("========================================================");
            deck.Print();

            // shuffle the deck and print the contents of the deck
            deck.Shuffle();
            Console.WriteLine("========================================================");
            Console.WriteLine("=============Deck after shuffle...======================");
            Console.WriteLine("========================================================");
            deck.Print();

            Console.WriteLine();

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

            Console.WriteLine("The first top card is a " + topCard);
            Console.WriteLine();

            // take the top card from the deck and print the card rank and suit
            topCard = deck.TakeTopCard();
            Console.WriteLine("The second top card is a " + topCard);
            Console.WriteLine();
        }
        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);
        }
Example #5
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

        }
Example #6
0
        /// <summary>
        /// Implements Lab 4 functionality
        /// </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();        //Initialize varaible deck with type Deck to get new type Deck

            // shuffle the deck and print the contents of the deck
            deck.Print();
            deck.Shuffle();
            Console.Write("Shuffling...");
            Console.ReadKey();      //Continue the shuffle process; Comment out ReadKey if annoying
            deck.Print();
            // take the top card from the deck and print the card rank and suit
            Card info1 = deck.TakeTopCard();                                          //the object card info(n) gets that decks top card

            Console.WriteLine("The top card was {0} of {1}", info1.Rank, info1.Suit); //info1 has Card properties Rank and Suit
            // take the top card from the deck and print the card rank and suit
            Card info2 = deck.TakeTopCard();

            Console.WriteLine("Then next top card was {0} of {1}", info2.Rank, info2.Suit); //info2 has Card properties Rank and Suit
        }
        /// <summary>
        /// Implements Lab 4 functionality
        /// </summary>
        /// <param name="args">command-line args</param>
        private static void Main(string[] args)
        {
            // create a new deck and print the contents of the deck
            Deck deck = new Deck();

            deck.Print();

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

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

            Console.WriteLine(string.Format("Top card: {0} of {1}", topCard.Rank, topCard.Suit));

            // take the top card from the deck and print the card rank and suit
            topCard = deck.TakeTopCard();
            Console.WriteLine(string.Format("Top card: {0} of {1}", topCard.Rank, topCard.Suit));
        }
        /// <summary>
        /// Demonstrates use of Deck and Card objects
        /// </summary>
        /// <param name="args">command-line args</param>
        static void Main(string[] args)
        {
            Deck objDesck = new Deck();

            objDesck.Print();

            objDesck.Shuffle();
            objDesck.Print();

            Card TopCard = objDesck.TakeTopCard();

            Console.WriteLine("{0} of {1}", TopCard.Rank, TopCard.Suit);
            Console.Read();
        }
        /// <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();
        }
Example #10
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();

            //print deck empty information
            Console.WriteLine("Empty: " + deck.Empty);

            //deck.Print();

            //tell deck to shuffle itself
            //deck.Shuffle();

            //cut the deck
            //deck.Cut(26);

            //take top card and print info
            Card card = deck.TakeTopCard();

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

            //take another top card and print info
            card = deck.TakeTopCard();
            Console.WriteLine(card.Rank + " of " + card.Suit);

            //Console.WriteLine();
            //deck.Print();

            Console.WriteLine();

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

            // 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
        }
Example #11
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);
        }