当前位置: 首页>>代码示例>>C#>>正文


C# PokerHandsChecker.IsFlush方法代码示例

本文整理汇总了C#中Poker.PokerHandsChecker.IsFlush方法的典型用法代码示例。如果您正苦于以下问题:C# PokerHandsChecker.IsFlush方法的具体用法?C# PokerHandsChecker.IsFlush怎么用?C# PokerHandsChecker.IsFlush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Poker.PokerHandsChecker的用法示例。


在下文中一共展示了PokerHandsChecker.IsFlush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestIsFlushFiveDifferentFaceEaqualSuitsNotSerial

        public void TestIsFlushFiveDifferentFaceEaqualSuitsNotSerial()
        {
            IList<ICard> cards = new List<ICard>();

            Card card1 = new Card(CardFace.Ace, CardSuit.Spades);
            cards.Add(card1);

            Card card2 = new Card(CardFace.Ten, CardSuit.Spades);
            cards.Add(card2);

            Card card3 = new Card(CardFace.Queen, CardSuit.Spades);
            cards.Add(card3);

            Card card4 = new Card(CardFace.Jack, CardSuit.Spades);
            cards.Add(card4);

            Card card5 = new Card(CardFace.Seven, CardSuit.Spades);
            cards.Add(card5);

            Hand hand = new Hand(cards);
            PokerHandsChecker checker = new PokerHandsChecker();

            bool actual = checker.IsFlush(hand);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
开发者ID:ValMomchilova,项目名称:TelerikAcademyHomeWorks,代码行数:27,代码来源:HandTests.cs

示例2: Main

        private static void Main()
        {
            try
            {
                IHand hand = new Hand(new List<ICard>() 
                { 
                    new Card(CardFace.Ace, CardSuit.Clubs),
                    new Card(CardFace.Queen, CardSuit.Clubs),
                    new Card(CardFace.King, CardSuit.Clubs),
                    new Card(CardFace.Jack, CardSuit.Clubs),
                    new Card(CardFace.Ten, CardSuit.Clubs),
                });
                Console.WriteLine(hand);
                IPokerHandsChecker checker = new PokerHandsChecker();

                Console.WriteLine(checker.IsValidHand(hand) ? "Hand is valid." : "Hand is not valid!");
                Console.WriteLine(checker.IsRoyalFlush(hand) ? "Royal flush." : "Hand is not Royal flush!");
                Console.WriteLine(checker.IsStraightFlush(hand) ? "Straight flush." : "Hand is not Straight flush!");
                Console.WriteLine(checker.IsFlush(hand) ? "Flush." : "Hand is not Flush!");
                Console.WriteLine(checker.IsStraight(hand) ? "Straight." : "Hand is not Straight!");
                Console.WriteLine(checker.IsFullHouse(hand) ? "Full house." : "Hand is not Full house!");
                Console.WriteLine(checker.IsFourOfAKind(hand) ? "Four of a kind." : "Hand is not Four of a kind!");
                Console.WriteLine(checker.IsThreeOfAKind(hand) ? "Three of a kind." : "Hand is not Three of a kind!");

                IHand hand1 = new Hand("K♥ J♥ 8♣ 7♦ 4♠");
                Console.WriteLine(hand1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:niki-funky,项目名称:Telerik_Academy,代码行数:32,代码来源:PokerDemo.cs

示例3: Main

        static void Main()
        {
            ICard card = new Card(CardFace.Ace, CardSuit.Clubs);
            Console.WriteLine(card);

            IHand hand = new Hand(new List<ICard>() { 
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.King, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Diamonds),
            });
            Console.WriteLine(hand);

            IPokerHandsChecker checker = new PokerHandsChecker();
            Console.WriteLine(checker.IsValidHand(hand));
            Console.WriteLine(checker.IsStraight(hand));
            Console.WriteLine(checker.IsOnePair(hand));
            Console.WriteLine(checker.IsTwoPair(hand));
            Console.WriteLine(checker.IsStraightFlush(hand));
            Console.WriteLine(checker.IsFlush(hand));
            Console.WriteLine(checker.IsFourOfAKind(hand));
            Console.WriteLine(checker.IsThreeOfAKind(hand));
            Console.WriteLine(checker.IsHighCard(hand));
            Console.WriteLine(checker.IsFullHouse(hand));
        }
开发者ID:vladislav-karamfilov,项目名称:TelerikAcademy,代码行数:26,代码来源:PokerExample.cs

示例4: TestIsFlushHandWithInvalidFlush

        public void TestIsFlushHandWithInvalidFlush()
        {
            PokerHandsChecker checker = new PokerHandsChecker();

            var cards = GenerateCorectCards();
            var hand = new Hand(cards);
            bool isflush = checker.IsFlush(hand);

            Assert.IsFalse(isflush, "Hand is invalid flush and result mast be false.");
        }
开发者ID:razsilev,项目名称:TelerikAcademy_Homework,代码行数:10,代码来源:PokerHandsCheckerTests.cs

示例5: TestIsNotFlushHandIfLessThan5Cards

        public void TestIsNotFlushHandIfLessThan5Cards()
        {
            IList<ICard> cards = new List<ICard>()
            {
                new Card(CardFace.Two, CardSuit.Diamonds)
            };

            Hand hand = new Hand(cards);
            PokerHandsChecker checker = new PokerHandsChecker();
            Assert.IsFalse(checker.IsFlush(hand));
        }
开发者ID:hristo11111,项目名称:TelerikAcademy-HristoBratanov,代码行数:11,代码来源:FlushHandTests.cs

示例6: TestForFlush

 public void TestForFlush()
 {
     IList<ICard> cardList = new List<ICard>();
     cardList.Add(new Card(CardFace.King, CardSuit.Hearts));
     cardList.Add(new Card(CardFace.Queen, CardSuit.Hearts));
     cardList.Add(new Card(CardFace.Ace, CardSuit.Hearts));
     cardList.Add(new Card(CardFace.Jack, CardSuit.Hearts));
     cardList.Add(new Card(CardFace.Ten, CardSuit.Hearts));
     var hand = new Hand(cardList);
     var handChecker = new PokerHandsChecker();
     Assert.AreEqual(true, handChecker.IsFlush(hand));
 }
开发者ID:hrist0stoichev,项目名称:Telerik-Homeworks,代码行数:12,代码来源:PokerHandsCheckerTests.cs

示例7: IsFlushTest

        public void IsFlushTest()
        {
            Hand pokerHand = new Hand(new List<ICard>(){ 
                                new Card(CardFace.Ace, CardSuit.Hearts),
                                new Card(CardFace.King, CardSuit.Hearts),
                                new Card(CardFace.Queen, CardSuit.Hearts),
                                new Card(CardFace.Jack, CardSuit.Hearts),
                                new Card(CardFace.Nine, CardSuit.Hearts)});

            PokerHandsChecker checker = new PokerHandsChecker();
            Assert.AreEqual(true, checker.IsFlush(pokerHand));
        }
开发者ID:BorislavIvanov,项目名称:Telerik_Academy,代码行数:12,代码来源:PokerHandsCheckerTest.cs

示例8: NotFlushHand

        public void NotFlushHand()
        {
            var hand = new Hand(new List<ICard>() {
                new Card(CardFace.Seven, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Clubs)
            });

            var checker = new PokerHandsChecker();
            Assert.IsFalse(checker.IsFlush(hand));
        }
开发者ID:Termininja,项目名称:TelerikAcademy,代码行数:13,代码来源:IsFlushHandTests.cs

示例9: TestFlushWithValidHand

        public void TestFlushWithValidHand()
        {
            Hand hand = new Hand(new List<ICard>() { 
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Clubs),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Clubs),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            Assert.AreEqual(true, checker.IsFlush(hand));
        }
开发者ID:VDGone,项目名称:TelerikAcademy-2,代码行数:13,代码来源:TestPokerHandChecker.cs

示例10: TestFlushWithInvalidCards

        public void TestFlushWithInvalidCards()
        {
            Hand hand = new Hand(new List<ICard>() { 
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Clubs),
                new Card(CardFace.Queen, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            Assert.AreEqual(false, checker.IsFlush(hand));
        }
开发者ID:VDGone,项目名称:TelerikAcademy-2,代码行数:13,代码来源:TestPokerHandChecker.cs

示例11: FlushNonValideHand_IsFalse

        public void FlushNonValideHand_IsFalse()
        {
            IHand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Hearts),
            });

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsFlush(hand));
        }
开发者ID:Bvaptsarov,项目名称:Homework,代码行数:13,代码来源:PokerHandsCheckerTest.cs

示例12: TestIsFlushLessCards

 public void TestIsFlushLessCards()
 {
     Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds);
     Card cardTwo = new Card(CardFace.Jack, CardSuit.Diamonds);
     Card cardThree = new Card(CardFace.Five, CardSuit.Diamonds);
     IList<ICard> cards = new List<ICard>();
     cards.Add(cardOne);
     cards.Add(cardTwo);
     cards.Add(cardThree);
     Hand hand = new Hand(cards);
     PokerHandsChecker poker = new PokerHandsChecker();
     bool isFlush = poker.IsFlush(hand);
     Assert.AreEqual(false, isFlush, "IsFlush() method in class PokerHandsChecker is not working correctly.");
 }
开发者ID:studware,项目名称:Ange-Git,代码行数:14,代码来源:IsFlushTest.cs

示例13: IsFlush_CheckWithoutFlush

        public void IsFlush_CheckWithoutFlush()
        {
            var cards = new List<ICard>() {
                new Card(CardFace.Two, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Clubs),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Hearts)
            };

            var hand = new Hand(cards);
            var pokerHandsChecker = new PokerHandsChecker();
            Assert.IsFalse(pokerHandsChecker.IsFlush(hand));
        }
开发者ID:androidejl,项目名称:Telerik,代码行数:14,代码来源:PokerHandsCheckerTests.cs

示例14: IsFlush_WhithInValidHand_ShouldThrow

        public void IsFlush_WhithInValidHand_ShouldThrow()
        {
            Hand hand = new Hand(new List<ICard>() {
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Diamonds),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();

            Assert.Throws(typeof(ArgumentException), new TestDelegate(() => {checker.IsFlush(hand);}), "IsFlush() with invalid hand should throw!");
        }
开发者ID:glifada,项目名称:TelerikAcademy,代码行数:14,代码来源:PokerHandsCheckerTests.cs

示例15: IsFlush_NoFlushWhithValidHand_ShouldReturnFalse

        public void IsFlush_NoFlushWhithValidHand_ShouldReturnFalse()
        {
            Hand hand = new Hand(new List<ICard>() {
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Diamonds),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();

            Assert.AreEqual(false, checker.IsFlush(hand));
        }
开发者ID:glifada,项目名称:TelerikAcademy,代码行数:14,代码来源:PokerHandsCheckerTests.cs


注:本文中的Poker.PokerHandsChecker.IsFlush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。