/// <summary>
        /// Implements Nothing Like Blackjack functionality
        /// </summary>
        /// <param name="args">command-line args</param>
        static void Main(string[] args)
        {
            // loop while there's more input
            string input = Console.ReadLine();

            while (input[0] != 'q')
            {
                // Add your code between this comment
                // and the comment below. You can of
                // course add more space between the
                // comments as needed

                // declare a deck variables and create a deck object
                Deck deck = new Deck();
                // DON'T SHUFFLE THE DECK

                // deal 2 cards each to 4 players (deal properly, dealing
                // the first card to each player before dealing the
                // second card to each player)
                Card p1  = deck.TakeTopCard();
                Card p2  = deck.TakeTopCard();
                Card p3  = deck.TakeTopCard();
                Card p4  = deck.TakeTopCard();
                Card p11 = deck.TakeTopCard();
                Card p22 = deck.TakeTopCard();
                Card p33 = deck.TakeTopCard();
                Card p44 = deck.TakeTopCard();
                // deal 1 more card to players 2 and 3
                Card p222 = deck.TakeTopCard();
                Card p333 = deck.TakeTopCard();
                // flip all the cards over
                p1.FlipOver();
                p11.FlipOver();
                p2.FlipOver();
                p22.FlipOver();
                p222.FlipOver();
                p3.FlipOver();
                p33.FlipOver();
                p333.FlipOver();
                p4.FlipOver();
                p44.FlipOver();
                // print the cards for player 1
                Console.WriteLine(p1.Rank + "," + p1.Suit);
                Console.WriteLine(p11.Rank + "," + p11.Suit);
                // print the cards for player 2
                Console.WriteLine(p2.Rank + "," + p2.Suit);
                Console.WriteLine(p22.Rank + "," + p22.Suit);
                Console.WriteLine(p222.Rank + "," + p222.Suit);
                // print the cards for player 3
                Console.WriteLine(p3.Rank + "," + p3.Suit);
                Console.WriteLine(p33.Rank + "," + p33.Suit);
                Console.WriteLine(p333.Rank + "," + p333.Suit);
                // print the cards for player 4
                Console.WriteLine(p4.Rank + "," + p4.Suit);
                Console.WriteLine(p44.Rank + "," + p44.Suit);
                // Don't add or modify any code below
                // this comment
                input = Console.ReadLine();
            }
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Hello. Now you're going to play a game \"Blackjack\"");
            // create and shuffle a deck
            Deck mainDeck = new Deck();

            mainDeck.Shuffle();

            //mainDeck.Print(); // For debug

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)

            //Init variables for card
            Card[] dealer       = new Card[2];
            Card[] firstPlayer  = new Card[2];
            Card[] secondPlayer = new Card[2];

            //Handing out cards

            for (int i = 0; i < 2; i++)
            {
                dealer[i]       = mainDeck.TakeTopCard();
                firstPlayer[i]  = mainDeck.TakeTopCard();
                secondPlayer[i] = mainDeck.TakeTopCard();
            }
            // flip all the cards over
            for (int i = 0; i < 2; i++)
            {
                dealer[i].FlipOver();
                firstPlayer[i].FlipOver();
                secondPlayer[i].FlipOver();
            }
            // print the cards for player 1
            Console.WriteLine("\nCard for Dealer:");
            for (int i = 0; i < 2; i++)
            {
                Console.WriteLine((i + 1) + " card is " + dealer[i].Rank + " of " + dealer[i].Suit);
            }
            // print the cards for player 2
            Console.WriteLine("\nCard for first player:");
            for (int i = 0; i < 2; i++)
            {
                Console.WriteLine((i + 1) + " card is " + firstPlayer[i].Rank + " of " + firstPlayer[i].Suit);
            }
            // print the cards for player 3
            Console.WriteLine("\nCard for second player:");
            for (int i = 0; i < 2; i++)
            {
                Console.WriteLine((i + 1) + " card is " + secondPlayer[i].Rank + " of " + secondPlayer[i].Suit);
            }
            Console.WriteLine();
        }
Exemple #3
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            List <Card> player1Hand = new List <Card>();
            List <Card> player2Hand = new List <Card>();
            List <Card> player3Hand = new List <Card>();

            // print welcome message
            Console.WriteLine("Hello. Let's play a game!");
            Console.WriteLine();

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            for (int i = 0; i <= 1; i++)
            {
                player1Hand.Add(deck.TakeTopCard());
                player2Hand.Add(deck.TakeTopCard());
                player3Hand.Add(deck.TakeTopCard());
            }

            // flip all the cards over
            for (int i = 0; i <= 1; i++)
            {
                player1Hand[i].FlipOver();
                player2Hand[i].FlipOver();
                player3Hand[i].FlipOver();
            }

            // print the cards for player 1
            Console.WriteLine("Player1 Cards:");
            Console.WriteLine(player1Hand[0].Rank + " of " + player1Hand[0].Suit);
            Console.WriteLine(player1Hand[1].Rank + " of " + player1Hand[1].Suit);
            Console.WriteLine();

            // print the cards for player 2
            Console.WriteLine("Player2 Cards:");
            Console.WriteLine(player2Hand[0].Rank + " of " + player2Hand[0].Suit);
            Console.WriteLine(player2Hand[1].Rank + " of " + player2Hand[1].Suit);
            Console.WriteLine();

            // print the cards for player 3
            Console.WriteLine("Player3 Cards:");
            Console.WriteLine(player3Hand[0].Rank + " of " + player3Hand[0].Suit);
            Console.WriteLine(player3Hand[1].Rank + " of " + player3Hand[1].Suit);

            Console.WriteLine();
        }
Exemple #4
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome!");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)

            Card[] person1Cards = new Card[2];
            Card[] person2Cards = new Card[2];
            Card[] person3Cards = new Card[2];
            for (int i = 0; i < 2; i++)
            {
                person1Cards[i] = deck.TakeTopCard();
                person2Cards[i] = deck.TakeTopCard();
                person3Cards[i] = deck.TakeTopCard();
            }

            // flip all the cards over
            for (int i = 0; i < 2; i++)
            {
                person1Cards[i].FlipOver();
                person2Cards[i].FlipOver();
                person3Cards[i].FlipOver();
            }

            // print the cards for player 1
            for (int i = 0; i < 2; i++)
            {
                Console.WriteLine("Cards for player 1 :" + person1Cards[i].Rank + " " + person1Cards[i].Suit);
            }
            // print the cards for player 2
            for (int i = 0; i < 2; i++)
            {
                Console.WriteLine("Cards for player 2 :" + person2Cards[i].Rank + " " + person2Cards[i].Suit);
            }
            // print the cards for player 3
            for (int i = 0; i < 2; i++)
            {
                Console.WriteLine("Cards for player 3 :" + person3Cards[i].Rank + " " + person3Cards[i].Suit);
            }
            Console.WriteLine();
        }
Exemple #5
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("-------------------------.::Welcome to Casino::.------------------------");
            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player
            Card card_1_for_player_1 = deck.TakeTopCard();
            Card card_1_for_player_2 = deck.TakeTopCard();
            Card card_1_for_player_3 = deck.TakeTopCard();
            Card card_2_for_player_1 = deck.TakeTopCard();
            Card card_2_for_player_2 = deck.TakeTopCard();
            Card card_2_for_player_3 = deck.TakeTopCard();
            Card card_3_for_player_1 = deck.TakeTopCard();
            Card card_3_for_player_2 = deck.TakeTopCard();
            Card card_3_for_player_3 = deck.TakeTopCard();

            // flip all the cards over
            card_1_for_player_1.FlipOver();
            card_1_for_player_2.FlipOver();
            card_1_for_player_3.FlipOver();
            card_2_for_player_1.FlipOver();
            card_2_for_player_2.FlipOver();
            card_2_for_player_3.FlipOver();
            card_3_for_player_1.FlipOver();
            card_3_for_player_2.FlipOver();
            card_3_for_player_3.FlipOver();
            // print the cards for player 1
            Console.WriteLine("Player 1 :");
            Console.WriteLine(card_1_for_player_1.Rank + " of " + card_1_for_player_1.Suit);
            Console.WriteLine(card_2_for_player_1.Rank + " of " + card_2_for_player_1.Suit);
            Console.WriteLine(card_3_for_player_1.Rank + " of " + card_3_for_player_1.Suit);
            Console.WriteLine();
            // print the cards for player 2
            Console.WriteLine("Player 2 :");
            Console.WriteLine(card_1_for_player_2.Rank + " of " + card_1_for_player_2.Suit);
            Console.WriteLine(card_2_for_player_2.Rank + " of " + card_2_for_player_2.Suit);
            Console.WriteLine(card_3_for_player_2.Rank + " of " + card_3_for_player_2.Suit);
            Console.WriteLine();
            // print the cards for player 3
            Console.WriteLine("Player 3 :");
            Console.WriteLine(card_1_for_player_3.Rank + " of " + card_1_for_player_3.Suit);
            Console.WriteLine(card_2_for_player_3.Rank + " of " + card_2_for_player_3.Suit);
            Console.WriteLine(card_3_for_player_3.Rank + " of " + card_3_for_player_3.Suit);

            Console.WriteLine();
        }
Exemple #6
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        public static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to the game!");
            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card a_1 = deck.TakeTopCard();
            Card b_1 = deck.TakeTopCard();
            Card c_1 = deck.TakeTopCard();
            Card a_2 = deck.TakeTopCard();
            Card b_2 = deck.TakeTopCard();
            Card c_2 = deck.TakeTopCard();

            // flip all the cards over
            a_1.FlipOver();
            a_2.FlipOver();
            b_1.FlipOver();
            b_2.FlipOver();
            c_1.FlipOver();
            c_2.FlipOver();
            // print the cards for player 1
            Console.WriteLine("The cards of player 1 are " + a_1.Rank + " of " + a_1.Suit + " and " + a_2.Rank + " of " + a_2.Suit);
            // print the cards for player 2
            Console.WriteLine("The cards of player 2 are " + b_1.Rank + " of " + b_1.Suit + " and " + b_2.Rank + " of " + b_2.Suit);
            // print the cards for player 3
            Console.WriteLine("The cards of player 3 are " + c_1.Rank + " of " + c_1.Suit + " and " + c_2.Rank + " of " + c_2.Suit);
            Console.WriteLine();
        }
Exemple #7
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome \n");
            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player

            Card[,] player = new Card[3, 2];                    // each row represents a player's cards

            for (int col = 0; col < player.GetLength(1); col++) // the array fills column wise to ensure proper dealing
            {
                for (int row = 0; row < player.GetLength(0); row++)
                {
                    player[row, col] = deck.TakeTopCard();
                }
            }

            // flip all the cards over
            for (int row = 0; row < player.GetLength(0); row++) // cards are flipped row wise
            {
                for (int col = 0; col < player.GetLength(1); col++)
                {
                    player[row, col].FlipOver();
                }
            }

            // print the cards for player 1

            for (int row = 0; row < player.GetLength(0); row++) // all player's cards are printed
            {
                Console.WriteLine("Player " + (row + 1) + ": ");

                for (int col = 0; col < player.GetLength(1); col++)
                {
                    Console.WriteLine(player[row, col].Rank + " of " + player[row, col].Suit);
                }
                Console.WriteLine();
            }

            // // print the cards for player 2

            // // print the cards for player 3
        }
Exemple #8
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome come to Card Game!(3 player)");
            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card[] player1 = new Card[2];
            Card[] player2 = new Card[2];
            Card[] player3 = new Card[2];
            // deal first card
            Console.WriteLine("Deal first card...");
            player1[0] = deck.TakeTopCard();
            player2[0] = deck.TakeTopCard();
            player3[0] = deck.TakeTopCard();
            // deal second card
            Console.WriteLine("Deal second card...");
            player1[1] = deck.TakeTopCard();
            player2[1] = deck.TakeTopCard();
            player3[1] = deck.TakeTopCard();
            // flip all the cards over
            Console.WriteLine("Flip all the cards over...");
            player1[0].FlipOver();
            player2[0].FlipOver();
            player3[0].FlipOver();
            player1[1].FlipOver();
            player2[1].FlipOver();
            player3[1].FlipOver();
            // print the cards for player 1
            void printCard(Card[] player)
            {
                int i;

                for (i = 0; i < player.Length; i++)
                {
                    Console.WriteLine(player[i].Rank + " " + player[i].Suit);
                }
            }

            Console.WriteLine("Cards for player 1: ");
            printCard(player1);
            // print the cards for player 2
            Console.WriteLine("Cards for player 2: ");
            printCard(player2);
            // print the cards for player 3
            Console.WriteLine("Cards for player 3: ");
            printCard(player3);
            Console.WriteLine();
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.SetCursorPosition(Console.BufferWidth / 2 - 13, 0);
            //Writes text
            Console.WriteLine("Welcome User.");
            Console.SetCursorPosition(Console.BufferWidth / 2 - 26, 1);
            Console.WriteLine("This program will deal 2 cards to 3 players");
            Console.SetCursorPosition(Console.BufferWidth / 2 - 26, 2);
            Console.WriteLine(" and display the cards from the players.");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)

            //takes the first card for players 1,2,3
            Card p1_C1 = deck.TakeTopCard();
            Card p2_C1 = deck.TakeTopCard();
            Card p3_C1 = deck.TakeTopCard();
            //takes the second card for players 1,2,3
            Card p1_C2 = deck.TakeTopCard();
            Card p2_C2 = deck.TakeTopCard();
            Card p3_C2 = deck.TakeTopCard();

            // flip all the cards over
            p1_C1.FlipOver();
            p1_C2.FlipOver();
            p2_C1.FlipOver();
            p2_C2.FlipOver();
            p3_C1.FlipOver();
            p3_C2.FlipOver();

            // print the cards for player 1
            Console.WriteLine("Player one Card one: {0} of {1}", p1_C1.Rank, p1_C1.Suit);
            Console.WriteLine("Player one Card two: {0} of {1}", p1_C2.Rank, p1_C2.Suit);
            // space
            Console.WriteLine();
            // print the cards for player 2
            Console.WriteLine("Player one Card one: {0} of {1}", p2_C1.Rank, p2_C1.Suit);
            Console.WriteLine("Player one Card two: {0} of {1}", p2_C2.Rank, p2_C2.Suit);
            // space
            Console.WriteLine();
            // print the cards for player 3
            Console.WriteLine("Player one Card one: {0} of {1}", p3_C1.Rank, p3_C1.Suit);
            Console.WriteLine("Player one Card two: {0} of {1}", p3_C2.Rank, p3_C2.Suit);
            // space
            Console.WriteLine();
            Console.WriteLine("Press any Key to close the Program . . .");
            Console.ReadKey();
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to the game.");
            Console.WriteLine();

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            //Console.WriteLine("Below is the shuffled order of cards :");
            //deck.Print();
            //Console.WriteLine();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card player1_c1 = deck.TakeTopCard();
            Card player2_c1 = deck.TakeTopCard();
            Card player3_c1 = deck.TakeTopCard();

            Card player1_c2 = deck.TakeTopCard();
            Card player2_c2 = deck.TakeTopCard();
            Card player3_c2 = deck.TakeTopCard();

            // flip all the cards over
            player1_c1.FlipOver();
            player2_c1.FlipOver();
            player3_c1.FlipOver();
            player1_c2.FlipOver();
            player2_c2.FlipOver();
            player3_c2.FlipOver();

            // print the cards for player 1
            Console.WriteLine("Below are the cards in First Players hand :");
            Console.WriteLine(player1_c1.Rank + " of " + player1_c1.Suit);
            Console.WriteLine(player1_c2.Rank + " of " + player1_c2.Suit);
            Console.WriteLine();

            // print the cards for player 2
            Console.WriteLine("Below are the cards in First Players hand :");
            Console.WriteLine(player2_c1.Rank + " of " + player2_c1.Suit);
            Console.WriteLine(player2_c2.Rank + " of " + player2_c2.Suit);
            Console.WriteLine();

            // print the cards for player 3
            Console.WriteLine("Below are the cards in First Players hand :");
            Console.WriteLine(player3_c1.Rank + " of " + player3_c1.Suit);
            Console.WriteLine(player3_c2.Rank + " of " + player3_c2.Suit);
            Console.WriteLine();

            Console.WriteLine();
        }
        /// <summary>
        /// Implements Nothing Like Blackjack functionality
        /// </summary>
        /// <param name="args">command-line args</param>
        static void Main(string[] args)
        {
            Player player1 = new Player("Player 1");
            Player player2 = new Player("Player 2");
            Player player3 = new Player("Player 3");
            Player player4 = new Player("Player 4");


            // Add your code between this comment
            // and the comment below. You can of
            // course add more space between the
            // comments as needed

            // declare a deck variable and create a deck object
            Deck deck = new Deck();

            // DON'T SHUFFLE THE DECK

            // deal 2 cards each to 4 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            for (var i = 2; i > 0; i--)
            {
                player1.drawCard(deck.TakeTopCard());
                player2.drawCard(deck.TakeTopCard());
                player3.drawCard(deck.TakeTopCard());
                player4.drawCard(deck.TakeTopCard());
            }
            // deal 1 more card to players 2 and 3
            player2.drawCard(deck.TakeTopCard());
            player3.drawCard(deck.TakeTopCard());

            // flip all the cards over
            player1.flipCards();
            player2.flipCards();
            player3.flipCards();
            player4.flipCards();

            // print the cards for player 1
            player1.showCards();

            // print the cards for player 2
            player2.showCards();

            // print the cards for player 3
            player3.showCards();

            // print the cards for player 4
            player4.showCards();
        }
Exemple #12
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Dear User. Please be welome to our Game: Blackjack!!");

            // create and shuffle a deck
            Deck deck = new Deck();

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

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card Player1_1 = deck.TakeTopCard();
            Card Player2_1 = deck.TakeTopCard();
            Card Player3_1 = deck.TakeTopCard();
            Card Player1_2 = deck.TakeTopCard();
            Card Player2_2 = deck.TakeTopCard();
            Card Player3_2 = deck.TakeTopCard();

            // flip all the cards over
            Player1_1.FlipOver();
            Player2_1.FlipOver();
            Player3_1.FlipOver();
            Player1_2.FlipOver();
            Player2_2.FlipOver();
            Player3_2.FlipOver();

            // print the cards for player 1
            Console.WriteLine("The cards of the Player 1 are: ");
            Console.WriteLine("Card 1: " + Player1_1.Rank + " of " + Player1_1.Suit);
            Console.WriteLine("Card 2: " + Player1_2.Rank + " of " + Player1_2.Suit);
            Console.WriteLine();
            // print the cards for player 2
            Console.WriteLine("The cards of the Player 2 are: ");
            Console.WriteLine("Card 1: " + Player2_1.Rank + " of " + Player2_1.Suit);
            Console.WriteLine("Card 2: " + Player2_2.Rank + " of " + Player2_2.Suit);
            Console.WriteLine();

            // print the cards for player 3
            Console.WriteLine("The cards of the Player 3 are: ");
            Console.WriteLine("Card 1: " + Player3_1.Rank + " of " + Player3_1.Suit);
            Console.WriteLine("Card 2: " + Player3_2.Rank + " of " + Player3_2.Suit);
            Console.WriteLine();


            Console.WriteLine();
        }
Exemple #13
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to the game called 'Nothing Like Blackjack!");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)

            //deal first card to each player
            Card card1ForPlayer1 = deck.TakeTopCard();
            Card card1ForPlayer2 = deck.TakeTopCard();
            Card card1ForPlayer3 = deck.TakeTopCard();

            //deal second card to each player
            Card card2ForPlayer1 = deck.TakeTopCard();
            Card card2ForPlayer2 = deck.TakeTopCard();
            Card card2ForPlayer3 = deck.TakeTopCard();

            // flip all the cards over for each player
            card1ForPlayer1.FlipOver();
            card1ForPlayer2.FlipOver();
            card1ForPlayer3.FlipOver();
            card2ForPlayer1.FlipOver();
            card2ForPlayer2.FlipOver();
            card2ForPlayer3.FlipOver();

            // print the cards for player
            Console.WriteLine("For Player 1:");
            Console.WriteLine("Your first card is " + card1ForPlayer1.Rank + " of " + card1ForPlayer1.Suit);
            Console.WriteLine("Your second card is " + card2ForPlayer1.Rank + " of " + card2ForPlayer1.Suit + "\n");

            // print the cards for player 2
            Console.WriteLine("For Player 2:");
            Console.WriteLine("Your first card is " + card1ForPlayer2.Rank + " of " + card1ForPlayer2.Suit);
            Console.WriteLine("Your second card is " + card2ForPlayer2.Rank + " of " + card2ForPlayer2.Suit + "\n");

            // print the cards for player 3
            Console.WriteLine("For Player 3:");
            Console.WriteLine("Your first card is " + card1ForPlayer3.Rank + " of " + card1ForPlayer3.Suit);
            Console.WriteLine("Your second card is " + card2ForPlayer3.Rank + " of " + card2ForPlayer3.Suit + "\n");

            Console.WriteLine();
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to Nothing like Blackjack");
            Console.WriteLine();

            // create and shuffle a deck
            Deck deck;

            deck = new Deck();
            deck.Shuffle();
            // deck.Print();
            Console.WriteLine();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)

            Card player1card1 = deck.TakeTopCard();
            Card player2card1 = deck.TakeTopCard();
            Card player3card1 = deck.TakeTopCard();

            Card player1card2 = deck.TakeTopCard();
            Card player2card2 = deck.TakeTopCard();
            Card player3card2 = deck.TakeTopCard();

            // flip all the cards over
            player1card1.FlipOver();
            player2card1.FlipOver();
            player3card1.FlipOver();

            player1card2.FlipOver();
            player2card2.FlipOver();
            player3card2.FlipOver();


            // print the cards for player 1
            Console.WriteLine("The cards of Player1 are: " + player1card1 + " and " + player1card2);
            Console.WriteLine();

            // print the cards for player 2
            Console.WriteLine("The cards of Player1 are: " + player2card1 + " and " + player2card2);
            Console.WriteLine();

            // print the cards for player 3
            Console.WriteLine("The cards of Player1 are: " + player3card1 + " and " + player3card2);
            Console.WriteLine();
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("----------------------------Welcome to the Casino--------------------------");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card firstCardForPlayer1 = deck.TakeTopCard();
            Card firstCardForPlayer2 = deck.TakeTopCard();
            Card firstCardForPlayer3 = deck.TakeTopCard();

            Card secondCardForPlayer1 = deck.TakeTopCard();
            Card secondCardForPlayer2 = deck.TakeTopCard();
            Card secondCardForPlayer3 = deck.TakeTopCard();

            // flip all the cards over
            firstCardForPlayer1.FlipOver();
            firstCardForPlayer2.FlipOver();
            firstCardForPlayer3.FlipOver();

            secondCardForPlayer1.FlipOver();
            secondCardForPlayer2.FlipOver();
            secondCardForPlayer3.FlipOver();

            // print the cards for player 1
            Console.WriteLine("Player 1 Cards:");
            Console.WriteLine(firstCardForPlayer1.Rank + " of " + firstCardForPlayer1.Suit);
            Console.WriteLine(secondCardForPlayer1.Rank + " of " + secondCardForPlayer1.Suit);

            // print the cards for player 2
            Console.WriteLine("Player 2 Cards:");
            Console.WriteLine(firstCardForPlayer2.Rank + " of " + firstCardForPlayer2.Suit);
            Console.WriteLine(secondCardForPlayer2.Rank + " of " + secondCardForPlayer2.Suit);

            // print the cards for player 3
            Console.WriteLine("Player 3 Cards:");
            Console.WriteLine(firstCardForPlayer3.Rank + " of " + firstCardForPlayer3.Suit);
            Console.WriteLine(secondCardForPlayer3.Rank + " of " + secondCardForPlayer3.Suit);

            Console.WriteLine();
        }
Exemple #16
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to the Playing Cards Console Application!!");

            //Shuffle Card Deck
            Deck cardDeck = ShuffleCardDeck();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card player1Card1 = cardDeck.TakeTopCard();
            Card player2Card1 = cardDeck.TakeTopCard();
            Card player3Card1 = cardDeck.TakeTopCard();
            Card player1Card2 = cardDeck.TakeTopCard();
            Card player2Card2 = cardDeck.TakeTopCard();
            Card player3Card2 = cardDeck.TakeTopCard();

            // flip all the cards over
            Console.WriteLine("The players dealt cards are flipover");
            player1Card1.FlipOver();
            player2Card1.FlipOver();
            player3Card1.FlipOver();
            player1Card2.FlipOver();
            player2Card2.FlipOver();
            player3Card2.FlipOver();
            Console.WriteLine();

            // print the cards for player 1
            Console.WriteLine("Player1 Dealt Card Details:");
            Console.WriteLine(player1Card1.Rank + " of " + player1Card1.Suit);
            Console.WriteLine(player1Card2.Rank + " of " + player1Card2.Suit);
            Console.WriteLine();

            // print the cards for player 2
            Console.WriteLine("Player2 Dealt Card Details:");
            Console.WriteLine(player2Card1.Rank + " of " + player2Card1.Suit);
            Console.WriteLine(player2Card2.Rank + " of " + player2Card2.Suit);
            Console.WriteLine();

            // print the cards for player 3
            Console.WriteLine("Player3 Dealt Card Details:");
            Console.WriteLine(player3Card1.Rank + " of " + player3Card1.Suit);
            Console.WriteLine(player3Card2.Rank + " of " + player3Card2.Suit);
            Console.WriteLine();
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to the game!");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card firstOne  = deck.TakeTopCard();
            Card firstTwo  = deck.TakeTopCard();
            Card secondOne = deck.TakeTopCard();
            Card secondTwo = deck.TakeTopCard();
            Card thirdOne  = deck.TakeTopCard();
            Card thirdTwo  = deck.TakeTopCard();



            // flip all the cards over
            firstOne.FlipOver();
            firstTwo.FlipOver();
            secondOne.FlipOver();
            secondTwo.FlipOver();
            thirdOne.FlipOver();
            thirdTwo.FlipOver();

            Console.WriteLine("Player One:");
            // print the cards for player 1
            Console.WriteLine(firstOne.Rank + " for " + firstOne.Suit);
            Console.WriteLine(firstTwo.Rank + " for " + firstTwo.Suit);
            Console.WriteLine("Player Two:");
            // print the cards for player 2
            Console.WriteLine(secondOne.Rank + " for " + secondOne.Suit);
            Console.WriteLine(secondTwo.Rank + " for " + secondTwo.Suit);
            Console.WriteLine("Player Three:");
            // print the cards for player 3
            Console.WriteLine(thirdOne.Rank + " for " + thirdOne.Suit);
            Console.WriteLine(thirdTwo.Rank + " for " + thirdTwo.Suit);

            Console.WriteLine();
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to Bob's Coursera Assignment #2!");
            Console.WriteLine();
            // create and shuffle a deck
            Deck deckOfCards = new Deck();

            deckOfCards.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card playerOneCardOne   = deckOfCards.TakeTopCard();
            Card playerTwoCardOne   = deckOfCards.TakeTopCard();
            Card playerThreeCardOne = deckOfCards.TakeTopCard();
            Card playerOneCardTwo   = deckOfCards.TakeTopCard();
            Card playerTwoCardTwo   = deckOfCards.TakeTopCard();
            Card playerThreeCardTwo = deckOfCards.TakeTopCard();


            // flip all the cards over
            playerOneCardOne.FlipOver();
            playerTwoCardOne.FlipOver();
            playerThreeCardOne.FlipOver();
            playerOneCardTwo.FlipOver();
            playerTwoCardTwo.FlipOver();
            playerThreeCardTwo.FlipOver();

            // print the cards for player 1
            Console.WriteLine("The first card for player one is " + playerOneCardOne.Suit + " of " + playerOneCardOne.Rank);
            Console.WriteLine("The second card for player one is " + playerOneCardTwo.Suit + " of " + playerOneCardTwo.Rank);
            Console.WriteLine();

            // print the cards for player 2
            Console.WriteLine("The first card for player two is " + playerTwoCardOne.Suit + " of " + playerTwoCardOne.Rank);
            Console.WriteLine("The second card for player two is " + playerTwoCardTwo.Suit + " of " + playerTwoCardTwo.Rank);
            Console.WriteLine();

            // print the cards for player 3
            Console.WriteLine("The first card for player three is " + playerThreeCardOne.Suit + " of " + playerOneCardOne.Rank);
            Console.WriteLine("The second card for player three is " + playerThreeCardTwo.Suit + " of " + playerThreeCardTwo.Rank);
            Console.WriteLine();

            Console.WriteLine();
        }
Exemple #19
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome Users, To the play of a deck of cards!");
            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            //deck.Print();
            Console.WriteLine();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card card1ForPlayer1 = deck.TakeTopCard();
            Card card1ForPlayer2 = deck.TakeTopCard();
            Card card1ForPlayer3 = deck.TakeTopCard();
            Card card2ForPlayer1 = deck.TakeTopCard();
            Card card2ForPlayer2 = deck.TakeTopCard();
            Card card2ForPlayer3 = deck.TakeTopCard();

            // flip all the cards over
            card1ForPlayer1.FlipOver();
            card1ForPlayer2.FlipOver();
            card1ForPlayer3.FlipOver();
            card2ForPlayer1.FlipOver();
            card2ForPlayer2.FlipOver();
            card2ForPlayer3.FlipOver();
            // print the cards for player 1
            Console.WriteLine("Cards of Player 1:");
            Console.WriteLine("Rank " + card1ForPlayer1.Rank + " of Suit " + card1ForPlayer1.Suit);
            Console.WriteLine("Rank " + card2ForPlayer1.Rank + " of Suit " + card2ForPlayer1.Suit);
            Console.WriteLine();
            // print the cards for player 2
            Console.WriteLine("Cards of Player 2:");
            Console.WriteLine("Rank " + card1ForPlayer2.Rank + " of Suit " + card1ForPlayer2.Suit);
            Console.WriteLine("Rank " + card2ForPlayer2.Rank + " of Suit " + card2ForPlayer2.Suit);
            Console.WriteLine();
            // print the cards for player 3
            Console.WriteLine("Cards of Player 3:");
            Console.WriteLine("Rank " + card1ForPlayer3.Rank + " of Suit " + card1ForPlayer3.Suit);
            Console.WriteLine("Rank " + card2ForPlayer3.Rank + " of Suit " + card2ForPlayer3.Suit);
            Console.WriteLine();
        }
Exemple #20
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome!");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card player1A = deck.TakeTopCard();
            Card player2A = deck.TakeTopCard();
            Card player3A = deck.TakeTopCard();

            Card player1B = deck.TakeTopCard();
            Card player2B = deck.TakeTopCard();
            Card player3B = deck.TakeTopCard();

            // flip all the cards over

            player1A.FlipOver();
            player2A.FlipOver();
            player3A.FlipOver();
            player1B.FlipOver();
            player2B.FlipOver();
            player3B.FlipOver();

            // print the cards for player 1
            Console.WriteLine("Card1 for player 1 " + player1A.Rank + player1A.Suit);
            Console.WriteLine("Card2 for player 1 " + player1B.Rank + player1B.Suit);

            // print the cards for player 2
            Console.WriteLine("Card1 for player 2 " + player2A.Rank + player2A.Suit);
            Console.WriteLine("Card2 for player 2 " + player2B.Rank + player2B.Suit);

            // print the cards for player 3
            Console.WriteLine("Card1 for player 3 " + player3A.Rank + player3A.Suit);
            Console.WriteLine("Card2 for player 3 " + player3B.Rank + player3B.Suit);
        }
Exemple #21
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to Nothing Like Blackjack");
            Console.WriteLine();

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card card1PlayerOne   = deck.TakeTopCard();
            Card card1PlayerTwo   = deck.TakeTopCard();
            Card card1PlayerThree = deck.TakeTopCard();

            Card card2PlayerOne   = deck.TakeTopCard();
            Card card2PlayerTwo   = deck.TakeTopCard();
            Card card2PlayerThree = deck.TakeTopCard();

            // flip all the cards over
            card1PlayerOne.FlipOver();
            card2PlayerOne.FlipOver();
            card1PlayerTwo.FlipOver();
            card2PlayerTwo.FlipOver();
            card1PlayerThree.FlipOver();
            card2PlayerThree.FlipOver();

            // print the cards for player 1
            Console.WriteLine("Player 1 Cards are: " + card1PlayerOne.Rank + " " + card1PlayerOne.Suit + " and " + card2PlayerOne.Rank + " " + card2PlayerOne.Suit);

            // print the cards for player 2
            Console.WriteLine("Player 2 Cards are: " + card1PlayerTwo.Rank + " " + card1PlayerTwo.Suit + " and " + card2PlayerTwo.Rank + " " + card2PlayerTwo.Suit);

            // print the cards for player 3
            Console.WriteLine("Player 3 Cards are: " + card1PlayerThree.Rank + " " + card1PlayerThree.Suit + " and " + card2PlayerThree.Rank + " " + card2PlayerThree.Suit);

            Console.WriteLine();
        }
Exemple #22
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Hi! We are going to play BACKJACK!");
            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card firstPlayerCard1  = deck.TakeTopCard();
            Card secondPlayerCard1 = deck.TakeTopCard();
            Card thirdPlayerCard1  = deck.TakeTopCard();
            Card firstPlayerCard2  = deck.TakeTopCard();
            Card secondPlayerCard2 = deck.TakeTopCard();
            Card thirdPlayerCard2  = deck.TakeTopCard();

            // flip all the cards over
            firstPlayerCard1.FlipOver();
            secondPlayerCard1.FlipOver();
            thirdPlayerCard1.FlipOver();
            firstPlayerCard2.FlipOver();
            secondPlayerCard2.FlipOver();
            thirdPlayerCard2.FlipOver();
            Console.WriteLine();
            // print the cards for player 1
            Console.WriteLine("First Card Player 1: " + firstPlayerCard1.Rank + " of " + firstPlayerCard1.Suit);
            Console.WriteLine("Second Card Player 1: " + firstPlayerCard2.Rank + " of " + firstPlayerCard2.Suit);
            Console.WriteLine();
            // print the cards for player 2
            Console.WriteLine("First Card Player 2: " + secondPlayerCard1.Rank + " of " + secondPlayerCard1.Suit);
            Console.WriteLine("Second Card Player 2: " + secondPlayerCard2.Rank + " of " + secondPlayerCard2.Suit);
            Console.WriteLine();
            // print the cards for player 3
            Console.WriteLine("First Card Player 3: " + thirdPlayerCard1.Rank + " of " + thirdPlayerCard1.Suit);
            Console.WriteLine("Second Card Player 3: " + thirdPlayerCard2.Rank + " of " + thirdPlayerCard2.Suit);
            Console.WriteLine();
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to Nothing Like Blackjack Game!");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card player1Card1 = deck.TakeTopCard();
            Card player2Card1 = deck.TakeTopCard();
            Card player3Card1 = deck.TakeTopCard();
            Card player1Card2 = deck.TakeTopCard();
            Card player2Card2 = deck.TakeTopCard();
            Card player3Card2 = deck.TakeTopCard();

            // flip all the cards over
            player1Card1.FlipOver();
            player1Card2.FlipOver();
            player2Card1.FlipOver();
            player2Card2.FlipOver();
            player3Card1.FlipOver();
            player3Card2.FlipOver();

            // print the cards for player 1
            Console.WriteLine("Player 1: " + player1Card1.Rank + " of " + player1Card1.Suit + ", " + player1Card2.Rank + " of " + player1Card2.Suit);

            // print the cards for player 2
            Console.WriteLine("Player 2: " + player2Card1.Rank + " of " + player2Card1.Suit + ", " + player2Card2.Rank + " of " + player2Card2.Suit);

            // print the cards for player 3
            Console.WriteLine("Player 3: " + player3Card1.Rank + " of " + player3Card1.Suit + ", " + player3Card2.Rank + " of " + player3Card2.Suit);

            Console.ReadLine();
        }
Exemple #24
0
        /// <summary>
        /// Implements Nothing Like Blackjack functionality
        /// </summary>
        /// <param name="args">command-line args</param>
        static void Main(string[] args)
        {
            // loop while there's more input
            //Use proprer input function to get value in the string input
            string input;

            while (input[0] != 'q')
            {
                // Add your code between this comment
                // and the comment below. You can of
                // course add more space between the
                // comments as needed

                // declare a deck variables and create a deck object
                // DON'T SHUFFLE THE DECK
                Deck deck = new Deck();

                // deal 2 cards each to 4 players (deal properly, dealing
                // the first card to each player before dealing the
                // second card to each player)
                Card card00 = deck.TakeTopCard();
                Card card10 = deck.TakeTopCard();
                Card card20 = deck.TakeTopCard();
                Card card30 = deck.TakeTopCard();

                Card card01 = deck.TakeTopCard();
                Card card11 = deck.TakeTopCard();
                Card card21 = deck.TakeTopCard();
                Card card31 = deck.TakeTopCard();



                // deal 1 more card to players 2 and 3

                Card card12 = deck.TakeTopCard();

                Card card22 = deck.TakeTopCard();

                // flip all the cards over
                card00.FlipOver();
                card01.FlipOver();

                card10.FlipOver();
                card11.FlipOver();
                card12.FlipOver();

                card20.FlipOver();
                card21.FlipOver();
                card22.FlipOver();

                card30.FlipOver();
                card31.FlipOver();



                // print the cards for player 1

                Console.WriteLine(card00.Rank + "," + card00.Suit);
                Console.WriteLine(card01.Rank + "," + card01.Suit);

                // print the cards for player 2

                Console.WriteLine(card10.Rank + "," + card10.Suit);
                Console.WriteLine(card11.Rank + "," + card11.Suit);
                Console.WriteLine(card12.Rank + "," + card12.Suit);


                // print the cards for player 3

                Console.WriteLine(card20.Rank + "," + card20.Suit);
                Console.WriteLine(card21.Rank + "," + card21.Suit);
                Console.WriteLine(card22.Rank + "," + card22.Suit);


                // print the cards for player 4


                Console.WriteLine(card30.Rank + "," + card30.Suit);
                Console.WriteLine(card31.Rank + "," + card31.Suit);

                // Don't add or modify any code below
                // this comment
                input = Console.ReadLine();
            }
        }
Exemple #25
0
        /// <summary>
        /// Implements Nothing Like Blackjack functionality
        /// </summary>
        /// <param name="args">command-line args</param>
        static void Main(string[] args)
        {
            // loop while there's more input
            string input = Console.ReadLine();

            while (input[0] != 'q')
            {
                // Add your code between this comment
                // and the comment below. You can of
                // course add more space between the
                // comments as needed

                // declare a deck variables and create a deck object
                // DON'T SHUFFLE THE DECK
                Deck deck1 = new Deck();

                // deal 2 cards each to 4 players (deal properly, dealing
                // the first card to each player before dealing the
                // second card to each player)
                Card card0 = deck1.TakeTopCard();
                Card card1 = deck1.TakeTopCard();
                Card card2 = deck1.TakeTopCard();
                Card card3 = deck1.TakeTopCard();
                Card card4 = deck1.TakeTopCard();
                Card card5 = deck1.TakeTopCard();
                Card card6 = deck1.TakeTopCard();
                Card card7 = deck1.TakeTopCard();



                // deal 1 more card to players 2 and 3
                Card card8 = deck1.TakeTopCard();
                Card card9 = deck1.TakeTopCard();

                // flip all the cards over
                card0.FlipOver();
                card1.FlipOver();
                card2.FlipOver();
                card3.FlipOver();
                card4.FlipOver();
                card5.FlipOver();
                card6.FlipOver();
                card7.FlipOver();
                card8.FlipOver();
                card9.FlipOver();



                // print the cards for player 1
                Console.WriteLine(card0.Rank + "," + card0.Suit);
                Console.WriteLine(card4.Rank + "," + card4.Suit);

                // print the cards for player 2

                Console.WriteLine(card1.Rank + "," + card1.Suit);
                Console.WriteLine(card5.Rank + "," + card5.Suit);
                Console.WriteLine(card8.Rank + "," + card8.Suit);

                // print the cards for player 3

                Console.WriteLine(card2.Rank + "," + card2.Suit);
                Console.WriteLine(card6.Rank + "," + card6.Suit);
                Console.WriteLine(card9.Rank + "," + card9.Suit);

                // print the cards for player 4

                Console.WriteLine(card3.Rank + "," + card3.Suit);
                Console.WriteLine(card7.Rank + "," + card7.Suit);

                // Don't add or modify any code below
                // this comment
                input = Console.ReadLine();
            }
        }
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        public static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome PLayers to your favourite game Blackjack !!!");
            // create and shuffle a deck
            Console.WriteLine();
            Console.WriteLine("Shuffling The Cards");
            Deck deck = new Deck();

            deck.Shuffle();


            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Console.WriteLine();
            Console.WriteLine("Dealing The Cards");


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

            Card   card1ForPLayer1 = deck.TakeTopCard();
            String P1card1         = card1ForPLayer1.Rank + " of " + card1ForPLayer1.Suit;

            Card   card1ForPlayer2 = deck.TakeTopCard();
            String P2card1         = card1ForPlayer2.Rank + " of " + card1ForPlayer2.Suit;

            Card   card1ForPlayer3 = deck.TakeTopCard();
            String P3card1         = card1ForPlayer3.Rank + " of " + card1ForPlayer3.Suit;

            Card   card2ForPLayer1 = deck.TakeTopCard();
            String P1card2         = card2ForPLayer1.Rank + " of " + card2ForPLayer1.Suit;

            Card   card2ForPlayer2 = deck.TakeTopCard();
            String P2card2         = card2ForPlayer2.Rank + " of " + card2ForPlayer2.Suit;

            Card   card2ForPlayer3 = deck.TakeTopCard();
            String P3card2         = card2ForPlayer3.Rank + " of " + card2ForPlayer3.Suit;



            //Deck allCards = card1ForPLayer1, card1ForPlayer2;



            // flip all the cards over
            Console.WriteLine("Flipping the cards over.....");
            card1ForPLayer1.FlipOver();
            card1ForPlayer2.FlipOver();
            card1ForPlayer3.FlipOver();
            card2ForPLayer1.FlipOver();
            card2ForPlayer2.FlipOver();
            card2ForPlayer3.FlipOver();
            Console.WriteLine();

            // print the cards for player 1
            Console.WriteLine("Player One Cards:");
            Console.WriteLine(P1card1);
            Console.WriteLine(P1card2);
            Console.WriteLine();
            // print the cards for player 2
            Console.WriteLine("Player Two Cards:");
            Console.WriteLine(P2card1);
            Console.WriteLine(P2card2);
            Console.WriteLine();

            // print the cards for player 3
            Console.WriteLine("Player Three Cards:");
            Console.WriteLine(P3card1);
            Console.WriteLine(P3card2);

            Console.WriteLine();
        }
Exemple #27
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Hi! My name is <Corrupted files> and now we will play a game 'Blackjack'");
            Console.WriteLine();
            // create and shuffle a deck
            Console.WriteLine("So, heres our deck");

            Console.WriteLine("<Robot hand pulls a deck of cards from under the table>");
            Deck deck = new Deck();

            Console.WriteLine("<Robot hand shuffles the deck>");
            deck.Shuffle();
            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Console.WriteLine();
            Console.WriteLine("Your cards, gentlemen");
            Console.WriteLine("<Robot hand gives cards>");

            Card firstPlayerFirstCard  = deck.TakeTopCard();
            Card secondPlayerFirstCard = deck.TakeTopCard();
            Card thirdPlayerFirstCard  = deck.TakeTopCard();

            Card firstPlayerSecondCard  = deck.TakeTopCard();
            Card secondPlayerSecondCard = deck.TakeTopCard();
            Card thirdPlayerSecondCard  = deck.TakeTopCard();

            // flip all the cards over
            firstPlayerFirstCard.FlipOver();
            secondPlayerFirstCard.FlipOver();
            thirdPlayerFirstCard.FlipOver();

            firstPlayerSecondCard.FlipOver();
            secondPlayerSecondCard.FlipOver();
            thirdPlayerSecondCard.FlipOver();

            Console.WriteLine("<Robot hand flips over the cards>");
            Console.WriteLine();
            // print the cards for player 1
            Console.WriteLine("<Your cards are : >");

            Console.WriteLine(firstPlayerFirstCard.Rank + " of " + firstPlayerFirstCard.Suit);
            Console.WriteLine(firstPlayerSecondCard.Rank + " of " + firstPlayerSecondCard.Suit);

            Console.WriteLine();
            // print the cards for player 2
            Console.WriteLine("<Second player cards are : >");

            Console.WriteLine(secondPlayerFirstCard.Rank + " of " + secondPlayerFirstCard.Suit);
            Console.WriteLine(secondPlayerSecondCard.Rank + " of " + secondPlayerSecondCard.Suit);

            Console.WriteLine();
            // print the cards for player 3
            Console.WriteLine("<Third player cards are : >");

            Console.WriteLine(thirdPlayerFirstCard.Rank + " of " + thirdPlayerFirstCard.Suit);
            Console.WriteLine(thirdPlayerSecondCard.Rank + " of " + thirdPlayerSecondCard.Suit);

            Console.WriteLine();
        }
Exemple #28
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to Virtual Blackjack");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();


            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Console.WriteLine("I will deal two cards to each player: first one card to each player and then the second card to each player");
            Console.WriteLine("There are a total of three players in this game");

            //dealing cards
            Console.WriteLine("Dealing cards...");
            Console.WriteLine("Player 1...");
            Card card0 = deck.TakeTopCard();

            Console.ReadLine();

            Console.WriteLine("Player 2...");
            Card card1 = deck.TakeTopCard();


            Console.ReadLine();

            Console.WriteLine("Player 3...");
            Card card2 = deck.TakeTopCard();


            Console.ReadLine();

            Console.WriteLine("Second round of dealing...");

            Console.WriteLine("Player 1...");
            Card card3 = deck.TakeTopCard();


            Console.ReadLine();

            Console.WriteLine("Player 2...");
            Card card4 = deck.TakeTopCard();

            Console.ReadLine();

            Console.WriteLine("Player 3...");
            Card card5 = deck.TakeTopCard();

            Console.ReadLine();

            // flip all the cards over
            // print the cards for player 1
            Console.WriteLine("Flip your cards!");
            Console.ReadLine();
            Console.WriteLine("Player 1...");

            Console.WriteLine("First Card: " + card0.Rank + " of " + card0.Suit);
            Console.WriteLine("Second Card: " + card3.Rank + " of " + card3.Suit);

            Console.ReadLine();

            // print the cards for player 2
            Console.WriteLine("Player 2...");
            Console.WriteLine("First Card: " + card1.Rank + " of " + card1.Suit);
            Console.WriteLine("Second Card: " + card4.Rank + " of " + card4.Suit);

            Console.ReadLine();

            // print the cards for player 3
            Console.WriteLine("Player3...");
            Console.WriteLine("First Card: " + card2.Rank + " of " + card2.Suit);
            Console.WriteLine("Second Card: " + card5.Rank + " of " + card5.Suit);

            Console.ReadLine();

            Console.WriteLine("Winner Winner Chicken Dinner!");
            Console.ReadLine();
        }
Exemple #29
0
        /// <summary>
        /// Deals 2 cards to 3 players and displays cards for players
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // print welcome message
            Console.WriteLine("Welcome to the new version of BlackJack!!");

            // create and shuffle a deck
            Deck deck = new Deck();

            deck.Shuffle();

            // deal 2 cards each to 3 players (deal properly, dealing
            // the first card to each player before dealing the
            // second card to each player)
            Card[] p1 = new Card[2];
            Card[] p2 = new Card[2];
            Card[] p3 = new Card[2];

            p1[0] = deck.TakeTopCard();
            p2[0] = deck.TakeTopCard();
            p3[0] = deck.TakeTopCard();

            p1[1] = deck.TakeTopCard();
            p2[1] = deck.TakeTopCard();
            p3[1] = deck.TakeTopCard();

            // flip all the cards over
            for (int i = 0; i < 2; i++)
            {
                p1[i].FlipOver();
                p2[i].FlipOver();
                p3[i].FlipOver();
            }

            // print the cards for player 1
            for (int i = 0; i < 2; i++)
            {
                if (p1[i].FaceUp)
                {
                    Console.WriteLine((1 + i) + " card of Player 1: " + p1[i].Rank + " of " + p1[i].Suit);
                }
            }

            // print the cards for player 2
            for (int i = 0; i < 2; i++)
            {
                if (p2[i].FaceUp)
                {
                    Console.WriteLine((1 + i) + " card of Player 2: " + p2[i].Rank + " of " + p2[i].Suit);
                }
            }

            // print the cards for player 3
            for (int i = 0; i < 2; i++)
            {
                if (p3[i].FaceUp)
                {
                    Console.WriteLine((1 + i) + " card of Player 3: " + p3[i].Rank + " of " + p3[i].Suit);
                }
            }
            Console.WriteLine();
        }