Ejemplo n.º 1
0
        public void BlindPointsTest()
        {
            Blind blind = new Blind();

            blind.AddCard(card1);
            blind.AddCard(card2);
            Assert.AreEqual(2, blind.BlindPoints());
        }
Ejemplo n.º 2
0
        public void SwapCardTest()
        {
            Blind blind = new Blind();

            blind.AddCard(card1);
            blind.AddCard(card2);
            blind.SwapCard(0, card3);
            Assert.AreEqual(card3, blind.BlindCards[0]);
            Assert.AreEqual(card2, blind.BlindCards[1]);
            blind.SwapCard(1, card1);
            Assert.AreEqual(card1, blind.BlindCards[1]);
        }
Ejemplo n.º 3
0
        public void AddCardTest()
        {
            Blind blind = new Blind();

            blind.AddCard(card1);
            blind.AddCard(card2);
            Assert.AreEqual(card1, blind.BlindCards[0]);
            Assert.AreEqual(card2, blind.BlindCards[1]);
            blind.AddCard(card3);
            Assert.AreEqual(2, blind.BlindCards.Count);
            Assert.AreEqual(card1, blind.BlindCards[0]);
            Assert.AreEqual(card2, blind.BlindCards[1]);
        }
Ejemplo n.º 4
0
        private void DealCards(List <IPlayer> players)
        {
            bool missingTrump = true;

            while (missingTrump)
            {
                IDeck Deck        = new Piquet();
                int   timesAround = Deck.Cards.Count / players.Count;

                for (int i = 0; i < timesAround; ++i)
                {
                    foreach (IPlayer player in players)
                    {
                        player.AddToHand(Deck.GetTopCard());
                    }
                }
                Blind.AddCard(Deck.GetTopCard());
                Blind.AddCard(Deck.GetTopCard());

                players.ForEach(player =>
                {
                    missingTrump &= !player.Hand.Cards.Aggregate(false, (agg, card) => agg || card.IsTrump());
                });
                // If nobody got trump, wipe the hands and blind and start again
                if (missingTrump)
                {
                    players.ForEach(player =>
                    {
                        player.Hand = new Hand.Hand();
                    });
                    Blind = new Blind.Blind();
                }
            }
        }