Beispiel #1
0
        private void DisplayCards()
        {
            char suit = ' ';

            for (int i = 0; i < playerHand.Length; i++)
            {
                switch (playerHand[i].MySuit.ToString())
                {
                case "Heart":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 3 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 5);
                    break;

                case "Diamond":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 4 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 5);
                    break;

                case "Spades":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 5 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 5);
                    break;

                case "Club":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 6 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 5);
                    break;
                }
                DrawCard.WriteAt(playerHand[i].MyValue.ToString(), 20 * i + 5, 6);
            }

            for (int i = 0; i < computerHand.Length; i++)
            {
                switch (computerHand[i].MySuit.ToString())
                {
                case "Heart":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 3 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 17);
                    break;

                case "Diamond":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 4 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 17);
                    break;

                case "Spades":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 5 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 17);
                    break;

                case "Club":
                    suit = Encoding.GetEncoding(437).GetChars(new byte[] { 6 })[0];
                    DrawCard.WriteAt(suit, 20 * i + 6, 17);
                    break;
                }
                DrawCard.WriteAt(computerHand[i].MyValue.ToString(), 20 * i + 5, 18);
            }
        }
Beispiel #2
0
        public DeckOfCards()
        {
            deck       = new Card[NUM_OF_CARDS];
            playerHand = new Card[5];

            DrawCard.Player();
            DrawCard.Computer();

            Deck();
            DealCards();
            DisplayCards();

            HandRank rank = new HandRank();

            rank.FourOfAKind();
            Console.ReadKey();
        }