예제 #1
0
        static void Main(string[] args)
        {
            DealerClass cardsDeck = new DealerClass();

            cardsDeck.resetGame();
            Console.WriteLine("Please select from the below options:");
            Console.WriteLine("Press 1 to reset the game");
            Console.WriteLine("Press 2 to pick a card");
            Console.WriteLine("Press 3 to shuffle the deck");
            Console.WriteLine("Press 4 to print the decks");
            Console.WriteLine("Press X to exit.");
            string userInput = Console.ReadLine();

            userInput = Calculate(userInput, cardsDeck);
        }
예제 #2
0
        private static string Calculate(string userInput, DealerClass cardsDeck)
        {
            switch (userInput)
            {
            case "1":
                cardsDeck.resetGame();
                Console.WriteLine("The deck is reset");
                break;

            case "2":
                cardsDeck.pickCard();
                break;

            case "3":
                cardsDeck.shuffleDeck();

                break;

            case "4":      //write code to print all user cards. New feature
                                    cardsDeck.printDecks();

                break;

            case "X":
                return("");

            case "x":
                return("");

            default:
                Console.WriteLine("Invalid Input.");

                break;
            }
            Console.WriteLine("Press any of the options to continue : ");
            userInput = Console.ReadLine();
            userInput = Calculate(userInput, cardsDeck);
            return(userInput);
        }