Exemplo n.º 1
0
 public void DealCards(int numberOfCardsPrPlayer)
 {
     Console.WriteLine("Dealing cards...");
     foreach (var player in _players)
     {
         _deck.DealCard(numberOfCardsPrPlayer, player);
     }
     Console.WriteLine("Cards are deald!! let the game begin!!");
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Deck deck1 = new Deck();

            deck1.Shuffle();
            for (int i = 0; i < 52; i++)
            {
                Console.WriteLine("{0,-19}", deck1.DealCard());
                if ((i + 1) % 4 == 0)
                {
                    Console.WriteLine();
                }
            }
            Console.ReadLine();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            Deck   deck   = new Deck(); //Add new deck
            string choice = "";

            //Keep program open
            while (choice != "exit")
            {
                Console.WriteLine("Write 'Draw', 'Show', 'Sort' or 'Shuffle'. \n 'Exit' to quit.\n");
                choice = Console.ReadLine().ToLower(); //Make input case insensitive

                //Switch for program choices
                switch (choice)
                {
                case "draw":
                    List <Card> cards = deck.DealCard(1);
                    foreach (Card c in cards)
                    {
                        Console.WriteLine("\n You got " + c);
                    }
                    break;

                case "show":
                    deck.Show();
                    break;

                case "sort":
                    deck.Sort();
                    break;

                case "shuffle":
                    deck.Shuffle();
                    break;

                default:
                    break;
                }
                Console.WriteLine("\n");
            }
        }