static void Main(string[] args) { Deck newDeck = new Deck(); Console.WriteLine("Card Dealt: " + newDeck.Deal().stringVal); Console.WriteLine("Deck Count: " + newDeck.deck.Count); newDeck.Reset(); Console.WriteLine("Deck Reset: " + newDeck.deck.Count); newDeck.Shuffle(); Console.WriteLine("Shuffled Deck Top Card: " + newDeck.deck[0].stringVal); Player player1 = new Player("John"); player1.Draw(newDeck); Console.WriteLine("Player First Card: " + player1.hand[0].suit + " " + player1.hand[0].stringVal); Console.WriteLine("Player discards: " + player1.Discard().stringVal); }
static void Main(string[] args) { Deck newDeck = new Deck(); Card dealtCard = newDeck.Deal(); Console.WriteLine(dealtCard); newDeck.Reset(); newDeck.Shuffle(); Card newDealtCard = newDeck.Deal(); Player person = new Player("Kim", newDealtCard); person.Draw(); Console.WriteLine(newDeck); Console.WriteLine(person.Hand); person.Discard(1); Console.WriteLine(person.Hand); Console.WriteLine("Hello World!"); }
static void Main(string[] args) { Deck myDeck = new Deck(); // makes a deck instance Console.WriteLine(myDeck.Deal()); Console.WriteLine(myDeck.Cards.Count); myDeck.Reset(); Console.WriteLine(myDeck.Cards.Count); myDeck.Shuffle(); Player myPlayer = new Player("John"); myPlayer.Draw(myDeck); Console.WriteLine(myDeck.Cards.Count); myPlayer.Draw(myDeck); myPlayer.Draw(myDeck); myPlayer.Draw(myDeck); myPlayer.Draw(myDeck); Console.WriteLine(myDeck.Cards.Count); myPlayer.Discard(myPlayer.Hand, 3); Console.WriteLine(myPlayer.Hand.Count); }
static void Main(string[] args) { // Creating the Deck Deck playingDeck = new Deck(); // Checking to make sure the Deck was created properly // foreach(Card card in playingDeck.PlayerDeck) // { // Console.WriteLine(card.stringVal); // } //Test the Draw method Card Hand = playingDeck.Draw(); Console.WriteLine("You drew..." + Hand.stringVal); //Making sure Card was removed. // foreach(Card card in playingDeck.PlayerDeck) // { // Console.WriteLine(card.stringVal); // } // foreach(Card card in playingDeck.Backup) // { // Console.WriteLine(card.stringVal); // } //Testing the Reset method playingDeck.PlayerDeck = playingDeck.Reset(); // Console.WriteLine("player deck has been reset"); // foreach(Card card in playingDeck.PlayerDeck) // { // Console.WriteLine(card.stringVal); // } //Testing the shuffle method a few times Console.WriteLine("player deck will now be shuffled!!"); playingDeck.PlayerDeck = playingDeck.Shuffle(playingDeck.PlayerDeck); // foreach(Card card in playingDeck.PlayerDeck) // { // Console.WriteLine(card.stringVal); // } Console.WriteLine("player deck will now be shuffled again!!"); playingDeck.PlayerDeck = playingDeck.Shuffle(playingDeck.PlayerDeck); // foreach(Card card in playingDeck.PlayerDeck) // { // Console.WriteLine(card.stringVal); // } Console.WriteLine("player deck will now be shuffled again!!"); playingDeck.PlayerDeck = playingDeck.Shuffle(playingDeck.PlayerDeck); // foreach(Card card in playingDeck.PlayerDeck) // { // Console.WriteLine(card.stringVal); // } //Creating the Player Player Jesus = new Player("Jesus"); //Grabbing 5 cards from the deck Jesus.DrawHand(playingDeck); Jesus.ShowHand(); Jesus.Discard(playingDeck, 2); Jesus.Discard(playingDeck, 5); Jesus.DrawCard(playingDeck); Jesus.ShowHand(); }
static void Main(string[] args) { // Let's store all of our cards in a list // CODE GOES HERE Deck deck = new Deck(); List <Card> player1Hand = new List <Card>(); List <Card> player2Hand = new List <Card>(); Console.OutputEncoding = System.Text.Encoding.UTF8; Console.WriteLine("♠♥♦♣ Welcome to Cards ♠♥♦♣"); while (true) { Console.WriteLine("What do you want to do? "); Console.WriteLine("1. Create a new deck of cards"); Console.WriteLine("2. Deal two hands of cards"); Console.WriteLine("3. Show the players' hands"); Console.WriteLine("Q. Quit"); string input = Console.ReadLine(); if (input == "1") { // Create a new deck of cards deck.Reset(); } else if (input == "2") { // Deal cards to two players player1Hand = new List <Card>(); for (int i = 1; i <= 5; i++) { player1Hand.Add(deck.Deal()); } player2Hand = new List <Card>(); for (int i = 1; i <= 5; i++) { player2Hand.Add(deck.Deal()); } } else if (input == "3") { // Show both hands on the Console Console.WriteLine("Player 1"); foreach (Card card in player1Hand) { Console.WriteLine($"\t{card.Name}"); } Console.WriteLine("===================="); Console.WriteLine("Player 2"); foreach (Card card in player2Hand) { Console.WriteLine($"\t{card.Name}"); } } else if (input == "Q") { break; } // Wait for user to press enter and clear screen. Console.ReadLine(); Console.Clear(); } }