static void Main(string[] args) { Deck deck = new Deck(); for (int i = 0; i <= 3; i++) { string suit = ""; if (i == 0) suit = "hearts"; else if (i == 1) suit = "diamonds"; else if (i == 2) suit = "clubs"; else if (i == 3) suit = "spades"; for (int j = 2; j <= 14; j++) { Card card = new Card { Suit = suit, Number = j }; deck.AddCard(card); } } deck.PrintDeck(); deck.Shuffle(); deck.Shuffle(); deck.Shuffle(); deck.PrintDeck(); }
// Logic which runs the main menu and allows user to navigate throughout the application public static void LaunchMainMenu() { string menuOptionSelected = ""; Deck <Card> myDeck = new Deck <Card>(); myDeck = myDeck.CreateDeck(); do { menuOptionSelected = ""; PrintMainMenuOptions(); menuOptionSelected = Console.ReadLine(); Console.Clear(); switch (menuOptionSelected) { case "1": myDeck.PrintDeck(myDeck); PromptReturnToMenu(); Console.Clear(); break; case "2": myDeck.ShuffleDeck(); myDeck.PrintDeck(myDeck); PromptReturnToMenu(); Console.Clear(); break; case "3": AddACard(myDeck); myDeck.PrintDeck(myDeck); PromptReturnToMenu(); Console.Clear(); break; case "4": RemoveTheCard(myDeck); myDeck.PrintDeck(myDeck); PromptReturnToMenu(); Console.Clear(); break; case "5": Environment.Exit(0); break; default: Console.WriteLine("Your selection did not match one of the options below...\n"); break; } } while (menuOptionSelected != "5"); }
static void Main(string[] args) { var deck = new Deck(); deck.PrintDeck(); deck.Shuffle(); Console.WriteLine("\nSHUFFLED\n"); deck.PrintDeck(); Console.ReadKey(); }
static void Main(string[] args) { Deck deck = new Deck(); deck.PrintDeck(); deck.Initialize(); deck.Shuffle(); deck.PrintDeck(); }
static void Main(string[] args) { //delcare new deck Deck forPoker = new Deck(); //shuffle the cards forPoker.Shuffle(); //deal cards List <Cards> ListofCards = new List <Cards>(); ListofCards = forPoker.Deal(5); Console.WriteLine("Dealt Cards: "); foreach (var item in ListofCards) { item.DealFromDeck(); } Console.WriteLine("\n\nRemaining Cards in the Deck"); forPoker.PrintDeck(); //Console.WriteLine(string.Join("\n", ListofCards.OrderBy(x=>x))); Console.ReadKey(); }
static void Main(string[] args) { int input = 0; Deck myDeck = new Deck(); Card myCard = new Card(Face.Ace, Suit.Clubs); while (input != 6) { Console.WriteLine("1. Shuffles the deck"); Console.WriteLine("2. Draws a card from the deck"); Console.WriteLine("3. Discards a card to the discard pile"); Console.WriteLine("4. Prints the deck"); Console.WriteLine("5. Prints the discard"); input = int.Parse(Console.ReadLine()); if (input == 1) { myDeck.Shuffle(); Console.WriteLine(" "); Console.WriteLine("The deck has been shuffled!"); Console.WriteLine(" "); } if (input == 2) { myCard = myDeck.Draw(); } if (input == 3) { myDeck.Discard(myCard); myCard = null; } if (input == 4) { Console.WriteLine(" "); Console.WriteLine("This is the deck so far: "); myDeck.PrintDeck(); } if (input == 5) { Console.WriteLine(" "); Console.WriteLine("This is the current discard pile: "); myDeck.PrintDiscard(); } } }