コード例 #1
0
ファイル: Program.cs プロジェクト: snyderjd/DeckOfCards
        static void Main(string[] args)
        {
            Deck deck1 = new Deck();

            deck1.Shuffle();

            // Print out all the cards
            // foreach(Card card in deck1.Cards)
            // {
            //     Console.WriteLine($"{card.Name} of {card.Suit} has a value of {card.Value}");
            // }

            // Make a new player
            Player player1 = new Player();

            Console.WriteLine("===== Deal 2 Cards to player1 =====");

            // Deal 2 cards to player1
            player1.PrintCards();

            Console.WriteLine($"Remaining Cards {deck1.Cards.Count}");

            deck1.DealCards(player1, 2);
            player1.PrintCards();

            Console.WriteLine($"Remaining Cards {deck1.Cards.Count}");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: MiyaSteven/CSharp
        public static void Main(string[] args)
        {
            Deck firstDeck = new Deck();

            firstDeck.Shuffle();
            for (int i = 0; i < 52; i++)
            {
                Console.Write("{0, -19}", firstDeck.DealCards());
                if ((i + 1) % 4 == 0)
                {
                    Console.WriteLine();
                }
            }
            Console.ReadLine();
        }