Пример #1
0
        public void HandToString()
        {
            Deck deck = new Deck();
            deck.Shuffle(123456);
            IHand[] hands = deck.Deal(13, 1);

            Hand h = new Hand(hands[0]);

            Debug.WriteLine(h.ToString());
        }
Пример #2
0
        public void HandToString()
        {
            Deck deck = new Deck();
            deck.Shuffle(123456);
            IHand[] hands = deck.Deal(13, 1);

            Hand h = new Hand(hands[0]);

            Assert.AreEqual(10, h.Points());
            Assert.AreEqual(2, h.ExtraPoints());
        }
Пример #3
0
        public void Deck_Deals4HandsEachContains13Cards()
        {
            Deck deck = new Deck();

            IHand [] hands = deck.Deal(13, 4);

            Assert.AreEqual(4, hands.Length);
            Assert.AreEqual(13, hands[0].Count);
            Assert.AreEqual(13, hands[1].Count);
            Assert.AreEqual(13, hands[2].Count);
            Assert.AreEqual(13, hands[3].Count);
        }
Пример #4
0
        public void Deck_Deal4HandsEachWith0Cards()
        {
            Deck deck = new Deck();

            IHand[] hands = deck.Deal(0, 4);

            Assert.AreEqual(4, hands.Length);
            Assert.AreEqual(0, hands[0].Count);
            Assert.AreEqual(0, hands[1].Count);
            Assert.AreEqual(0, hands[2].Count);
            Assert.AreEqual(0, hands[3].Count);
        }
Пример #5
0
        public void Hand_CalcPointsPerSuite()
        {
            Deck deck = new Deck();
            deck.Shuffle(123456);
            IHand[] hands = deck.Deal(13, 1);

            IHand h = hands[0];

            Assert.AreEqual(6, h.Spades.Points());
            Assert.AreEqual(1, h.Hearts.Points());
            Assert.AreEqual(3, h.Diamonds.Points());
            Assert.AreEqual(0, h.Clubs.Points());
        }
Пример #6
0
        static void Main(string[] args)
        {
            Deck deck1 = new Deck();

            deck1.Shuffle();
            Card[] hand = new Card[5];
            for (int i = 0; i < 5; i++)
            {
                hand[i] = deck1.Deal();
            }
            foreach (Card card in hand)
            {
                card.Display();
            }
            deck1.Reset();
            deck1.cards[0].Display();
        }
Пример #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Card troyCard = new Card();

            troyCard.ModStringVal = "Ace of Spades";
            Console.WriteLine(troyCard.ModStringVal);
            Deck troyDeck = new Deck();

            troyDeck.Shuffle();

            Player troy = new Player("Troy");

            troy.Draw(troyDeck);


            Console.WriteLine(troyDeck.Deal());
        }
Пример #8
0
        static void Main(string[] args)
        {
            Deck deck1 = new Deck();

            //deck1.Shuffle();
            for (int i = 0; i < 104; i++)
            {
                //Console.Write(deck1.Deal());
                Console.Write("{0,-19}", deck1.Deal());
                Console.Write("{0,-19}", );
                Console.WriteLine(deck1.currentCard);
                if ((i + 1) % 4 == 0)
                {
                    Console.WriteLine();
                }
            }



            Console.ReadLine();
        } //end main
Пример #9
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;
            // create a new deck and display
            Deck deck = new Deck();

            Console.WriteLine("New Deck:\n");
            Console.WriteLine(deck);

            // shuffle deck and display
            deck.Shuffle();
            Console.WriteLine("\n\nShuffeled Deck:\n");
            Console.WriteLine(deck);

            // deal hands from testDeck and display
            deck = new Deck(TestDeck());
            Console.WriteLine("\n\nDealing hands of 5 cards from the test deck:\n");
            while (deck.Cards.Count >= 5)
            {
                Hand hand = new Hand(deck.Deal(5));
                Console.WriteLine(hand);
            }
        }
Пример #10
0
        static void Main(string[] args)
        {
            bool valid  = false;
            bool valid2 = false;
            Deck deck   = new Deck();

            deck.CreateDeck();
            while (valid2 == false)
            {
                Console.WriteLine("Would you like to shuffle the deck?");
                string shuffle = Console.ReadLine();
                if (shuffle.ToLower() == "yes")
                {
                    deck.Shuffle();
                    while (valid == false)
                    {
                        Console.WriteLine("Would you like to be dealt a card?");
                        string response = Console.ReadLine();
                        if (response.ToLower() == "yes")
                        {
                            deck.Deal();
                            Console.ReadLine();
                            valid = true;
                        }
                        else if (response.ToLower() == "no")
                        {
                            valid = true;
                        }
                        else
                        {
                            Console.WriteLine("Invalid Response, Please enter either 'yes' or 'no'");
                        }
                    }
                    valid2 = true;
                }
                else if (shuffle.ToLower() == "no")
                {
                    while (valid == false)
                    {
                        Console.WriteLine("Would you like to be dealt a card?");
                        string response = Console.ReadLine();
                        if (response.ToLower() == "yes")
                        {
                            deck.Deal();
                            Console.ReadLine();
                            valid = true;
                        }
                        else if (response.ToLower() == "no")
                        {
                            Console.Write("Exiting...");
                            valid = true;
                        }
                        else
                        {
                            Console.WriteLine("Invalid Response, Please enter either 'yes' or 'no'");
                        }
                    }
                    valid2 = true;
                }
                else
                {
                    Console.WriteLine("Invalid Response, Please enter either 'yes' or 'no'");
                }
            }
        }
Пример #11
0
 private void PrepareHands()
 {
     Deck deck = new Deck();
     deck.Shuffle();
     this.myHands = deck.Deal(myGame.NumberPlayers);
     if (deck.Cards.Length > 0) {
         //TODO create a kitty and notify players
     }
     myGame.PlayerControllers.ForEach(pc => pc.HandReady());
 }