コード例 #1
0
        public void ShouldCheckIfIsNotAStraightFlush()
        {
            var cartas = new List <Carta>
            {
                new Carta()
                {
                    NumCarta = NumCarta.Dez, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.Valete, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.Dama, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.Rei, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.As, Naipe = Naipes.Ouro
                },
            };

            var cartasIguais = HandChecker.IsStraightFlush(cartas);

            Assert.IsFalse(cartasIguais);
        }
コード例 #2
0
        public void ShouldCheckIfIsAStraightFlush()
        {
            var cartas = new List <Carta>
            {
                new Carta()
                {
                    NumCarta = NumCarta.Dois, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.Tres, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.Quatro, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.Cinco, Naipe = Naipes.Ouro
                },
                new Carta()
                {
                    NumCarta = NumCarta.Seis, Naipe = Naipes.Ouro
                },
            };

            var cartasIguais = HandChecker.IsStraightFlush(cartas);

            Assert.IsTrue(cartasIguais);
        }
コード例 #3
0
        public void IsStraightFlushTest()
        {
            Assert.True(HandChecker.IsStraightFlush(CardUtil.GetCards("AH KH QH JH TH")));
            Assert.True(HandChecker.IsStraightFlush(CardUtil.GetCards("KH QH JH TH 9H")));
            Assert.True(HandChecker.IsStraightFlush(CardUtil.GetCards("QH JH TH 9H 8H")));
            Assert.True(HandChecker.IsStraightFlush(CardUtil.GetCards("8H 7H 6H 5H 4H")));
            Assert.True(HandChecker.IsStraightFlush(CardUtil.GetCards("6H 5H 2H 3H 4H")));
            Assert.True(HandChecker.IsStraightFlush(CardUtil.GetCards("AH 5H 4H 3H 2H")));

            Assert.False(HandChecker.IsStraightFlush(CardUtil.GetCards("AH JH TH 9H 8H")));
            Assert.False(HandChecker.IsStraightFlush(CardUtil.GetCards("QH JH TS 9H 8H")));
        }
コード例 #4
0
        public Hands GetHand()
        {
            if (HandChecker.IsRoyalFlush(this.Cartas))
            {
                return(Hands.RoyalFlush);
            }
            if (HandChecker.IsStraightFlush(this.Cartas))
            {
                return(Hands.StraightFlush);
            }
            if (HandChecker.IsQuadra(this.Cartas))
            {
                return(Hands.Quadra);
            }
            if (HandChecker.IsFullHouse(this.Cartas))
            {
                return(Hands.FullHouse);
            }
            if (HandChecker.IsFlush(this.Cartas))
            {
                return(Hands.Flush);
            }
            if (HandChecker.IsStraight(this.Cartas))
            {
                return(Hands.Straight);
            }
            if (HandChecker.IsTrinca(this.Cartas))
            {
                return(Hands.Trinca);
            }
            if (HandChecker.IsTwoPairs(this.Cartas))
            {
                return(Hands.TwoPair);
            }
            if (HandChecker.IsPair(this.Cartas))
            {
                return(Hands.Pair);
            }

            return(Hands.HighCard);
        }