Beispiel #1
0
        public void playGame(int numGames)
        {
            int         counter = 0;
            List <Card> tableCards;
            List <Card> playerCards;
            HandChecker handChecker;

            do
            {
                deck.shuffleDeck();
                tableCards  = deck.drawNumCards(5);
                playerCards = deck.drawNumCards(2);
                handChecker = new HandChecker(tableCards.Concat(playerCards).ToList());
                stats.addStat(handChecker.getHandResult());
                counter++;
            }while (counter < numGames);

            for (int i = 0; i < tableCards.Count; i++)
            {
                tableCardsUI[i].Image = tableCards[i].getImage();
            }
            for (int i = 0; i < playerCards.Count; i++)
            {
                playerCardsUI[i].Image = playerCards[i].getImage();
            }
            result.Text       = handChecker.getHandResult().ToString();
            overallStats.Text = stats.ToString();
        }
Beispiel #2
0
        public void CompareFlushWinsOverHighCard()
        {
            var white = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Three, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Five, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Nine, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.King, Card.CardSuit.Diamonds));

            var black = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Clubs),
                new Card(Card.CardValue.Three, Card.CardSuit.Hearts),
                new Card(Card.CardValue.Five, Card.CardSuit.Spades),
                new Card(Card.CardValue.Nine, Card.CardSuit.Clubs),
                new Card(Card.CardValue.King, Card.CardSuit.Hearts));

            var checker = new HandChecker();

            var result = checker.Compare(black, white);

            Assert.AreEqual(white, result);
        }
        public void CompareFlushWinsOverPair()
        {
            var black = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Three, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Five, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Nine, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.King, Card.CardSuit.Diamonds));

            var white = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Clubs),
                new Card(Card.CardValue.Three, Card.CardSuit.Hearts),
                new Card(Card.CardValue.Three, Card.CardSuit.Spades),
                new Card(Card.CardValue.Nine, Card.CardSuit.Clubs),
                new Card(Card.CardValue.King, Card.CardSuit.Hearts));

            var checker = new HandChecker();

            var result = checker.Compare(black, white);

            Assert.AreEqual(black, result);
        }
Beispiel #4
0
        public void CompareHandsOtherWayAround()
        {
            var white = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Hearts),
                new Card(Card.CardValue.Three, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Five, Card.CardSuit.Spades),
                new Card(Card.CardValue.Nine, Card.CardSuit.Clubs),
                new Card(Card.CardValue.King, Card.CardSuit.Diamonds));

            var black = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Clubs),
                new Card(Card.CardValue.Three, Card.CardSuit.Hearts),
                new Card(Card.CardValue.Four, Card.CardSuit.Spades),
                new Card(Card.CardValue.Eight, Card.CardSuit.Clubs),
                new Card(Card.CardValue.Ace, Card.CardSuit.Hearts));

            var checker = new HandChecker();

            var result = checker.Compare(black, white);

            Assert.AreEqual(black, result);
        }
        public void CompareHandsOtherWayAround()
        {
            var white = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Hearts),
                new Card(Card.CardValue.Three, Card.CardSuit.Diamonds),
                new Card(Card.CardValue.Five, Card.CardSuit.Spades),
                new Card(Card.CardValue.Nine, Card.CardSuit.Clubs),
                new Card(Card.CardValue.King, Card.CardSuit.Diamonds));

            var black = new Hand(
                new Card(Card.CardValue.Two, Card.CardSuit.Clubs),
                new Card(Card.CardValue.Three, Card.CardSuit.Hearts),
                new Card(Card.CardValue.Four, Card.CardSuit.Spades),
                new Card(Card.CardValue.Eight, Card.CardSuit.Clubs),
                new Card(Card.CardValue.Ace, Card.CardSuit.Hearts));

            var checker = new HandChecker();

            var result = checker.Compare(black, white);

            Assert.AreEqual(black, result);
        }