예제 #1
0
파일: UnitTest1.cs 프로젝트: djvorr/SSE
        public void TestDeck()
        {
            Deck deck = new Deck();
            deck = deck.generateDeck();

            //Test to make sure all edge cases made it into the deck
            Assert.IsTrue(deck.Find('S', "9"), "Deck.GetCards failed for S9.");
            Assert.IsTrue(deck.Find('S', "A"), "Deck.GetCards failed for SA.");
            Assert.IsTrue(deck.Find('D', "9"), "Deck.GetCards failed for D9.");
            Assert.IsTrue(deck.Find('D', "A"), "Deck.GetCards failed for DA.");
            Assert.IsTrue(deck.Find('H', "9"), "Deck.GetCards failed for H9.");
            Assert.IsTrue(deck.Find('H', "A"), "Deck.GetCards failed for HA.");
            Assert.IsTrue(deck.Find('C', "9"), "Deck.GetCards failed for C9.");
            Assert.IsTrue(deck.Find('C', "A"), "Deck.GetCards failed for CA.");

            //Test to make sure the cards were evenly divided into hands.
            List<Hand> hands = deck.draw();

            Assert.IsTrue(hands[0].Find('S', "9"), "Deck.Draw failed for S9.");
            Assert.IsTrue(hands[0].Find('C', "Q"), "Deck.Draw failed for SA.");

            Assert.IsTrue(hands[1].Find('S', "A"), "Deck.Draw failed for D9.");
            Assert.IsTrue(hands[1].Find('C', "K"), "Deck.Draw failed for DA.");

            Assert.IsTrue(hands[2].Find('H', "9"), "Deck.Draw failed for H9.");
            Assert.IsTrue(hands[2].Find('C', "10"), "Deck.Draw failed for HA.");

            Assert.IsTrue(hands[3].Find('H', "J"), "Deck.Draw failed for C9.");
            Assert.IsTrue(hands[3].Find('C', "A"), "Deck.Draw failed for CA.");
        }
예제 #2
0
파일: Game.cs 프로젝트: djvorr/SSE
        public void deal()
        {
            Deck deck = new Deck();
            deck = deck.generateDeck();
            deck.shuffle();
            List<Hand> hands = deck.draw();

            player.hand = hands[0];
            cpu1.hand = hands[1];
            cpu2.hand = hands[2];
            cpu3.hand = hands[3];
        }