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


C# PokerHandsChecker.IsFullHouse方法代码示例

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


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

示例1: 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

示例2: 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

示例3: NotFullHouseHand

        public void NotFullHouseHand()
        {
            var hand = new Hand(new List<ICard>() {
                new Card(CardFace.Seven, CardSuit.Hearts),
                new Card(CardFace.King, CardSuit.Spades),
                new Card(CardFace.Ten, CardSuit.Diamonds),
                new Card(CardFace.Ten, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Clubs)
            });

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

示例4: TestIsFullHouseLessCards

 public void TestIsFullHouseLessCards()
 {
     Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds);
     Card cardTwo = new Card(CardFace.Two, CardSuit.Hearts);
     Card cardThree = new Card(CardFace.Two, CardSuit.Spades);
     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 isFullHouse = poker.IsFullHouse(hand);
     Assert.AreEqual(false, isFullHouse, "IsFullHouse() method in class PokerHandsChecker is not working correctly.");
 }
开发者ID:danielkaradaliev,项目名称:TelerikAcademyAssignments,代码行数:14,代码来源:IsFullHouseTests.cs

示例5: Main

        public static void Main()
        {
            var hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Seven, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.Queen, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
            });

            var pokerChecker = new PokerHandsChecker();

            bool result = pokerChecker.IsFullHouse(hand);
        }
开发者ID:BobbyBorisov,项目名称:TelerikAcademy,代码行数:15,代码来源:MainProgram.cs

示例6: TestIsFourOfAKindShouldReturnFalseWhenNotMatchingHandPassed_ThreeOfAKind

        public void TestIsFourOfAKindShouldReturnFalseWhenNotMatchingHandPassed_ThreeOfAKind()
        {
            var checker = new PokerHandsChecker();
            var cards = new List<ICard>
            {
                new Card(CardFace.Four, CardSuit.Spades),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Hearts),
                new Card(CardFace.Three, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Hearts)
            };
            var hand = new Hand(cards);

            Assert.IsFalse(checker.IsFullHouse(hand));
        }
开发者ID:Hri100v,项目名称:Telerik-Academy,代码行数:15,代码来源:PockerHandsChecker_Combinations.cs

示例7: IsFullHouse_HandWithTwoPairs

        public void IsFullHouse_HandWithTwoPairs()
        {
            IList<ICard> cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Hearts),
                new Card(CardFace.Six, CardSuit.Spades),
            };

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsFullHouse(hand));
        }
开发者ID:Nottyy,项目名称:TelerikAcademy,代码行数:17,代码来源:PokerHandsCheckerTestMethodIsFullHouse.cs

示例8: TwoPair

        public void TwoPair()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Ace, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Ace, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Queen, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Ten, CardSuit.Spades));
            cards.Add(new Card(CardFace.Ten, CardSuit.Clubs));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            bool result = checker.IsFullHouse(hand);
            bool expected = false;

            Assert.AreEqual(expected, result);
        }
开发者ID:bahtev,项目名称:TelerikAcademy,代码行数:18,代码来源:PokerHandsCheckerIsFullHouse.cs

示例9: IsNotFullHouseTest

        public void IsNotFullHouseTest()
        {
            Card twoOfHearts = new Card(CardFace.Two, CardSuit.Hearts);
            Card aceOfSpades = new Card(CardFace.Ace, CardSuit.Spades);
            Card aceOfHearts = new Card(CardFace.Ace, CardSuit.Hearts);
            Card aceOfClubs = new Card(CardFace.Ace, CardSuit.Clubs);
            Card tenOfHearts = new Card(CardFace.Ten, CardSuit.Hearts);

            List<ICard> cardsInHand = new List<ICard>();

            cardsInHand.Add(twoOfHearts);
            cardsInHand.Add(aceOfSpades);
            cardsInHand.Add(aceOfHearts);
            cardsInHand.Add(aceOfClubs);
            cardsInHand.Add(tenOfHearts);

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

            Assert.IsFalse(handsChecker.IsFullHouse(hand));
        }
开发者ID:hristo-iliev,项目名称:TelerikHW,代码行数:22,代码来源:FullHouseTest.cs

示例10: IsFullHouseTest

        public void IsFullHouseTest()
        {
            Card aceClubs = new Card(CardFace.Ace, CardSuit.Clubs);
            Card aceHearts = new Card(CardFace.Ace, CardSuit.Hearts);
            Card jackHearts = new Card(CardFace.Jack, CardSuit.Hearts);
            Card jackClubs = new Card(CardFace.Jack, CardSuit.Clubs);
            Card aceDiamonds = new Card(CardFace.Ace, CardSuit.Diamonds);

            List<ICard> cardsInHand = new List<ICard>();

            cardsInHand.Add(aceDiamonds);
            cardsInHand.Add(aceClubs);
            cardsInHand.Add(jackClubs);
            cardsInHand.Add(aceHearts);
            cardsInHand.Add(jackHearts);

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

            Assert.IsTrue(handsChecker.IsFullHouse(hand));
        }
开发者ID:hristo-iliev,项目名称:TelerikHW,代码行数:22,代码来源:FullHouseTest.cs

示例11: IsFullHouseNullTest

        public void IsFullHouseNullTest()
        {
            PokerHandsChecker handsChecker = new PokerHandsChecker();

            Assert.IsFalse(handsChecker.IsFullHouse(null));
        }
开发者ID:hristo-iliev,项目名称:TelerikHW,代码行数:6,代码来源:FullHouseTest.cs

示例12: IsNotFullHouseTestValidHand

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

            Hand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Three, CardSuit.Clubs),
                new Card(CardFace.Queen, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Clubs),
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Spades)
            });

            bool expectedIsFullHouse = false;
            bool actual;
            actual = checker.IsFullHouse(hand);
            Assert.AreEqual(expectedIsFullHouse, actual);
        }
开发者ID:bankova,项目名称:HighQualityCode,代码行数:18,代码来源:PokerHandsCheckerTest.cs

示例13: FullHouseCheckerShouldReturnTrueWhenHandIsAValidFullHouse

        public void FullHouseCheckerShouldReturnTrueWhenHandIsAValidFullHouse()
        {
            IPokerHandsChecker checker = new PokerHandsChecker();
            IHand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Eight, CardSuit.Diamonds),
                new Card(CardFace.Eight, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Spades),
                new Card(CardFace.Five, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Diamonds)
            });
            bool result = checker.IsFullHouse(hand);
            bool expected = true;

            Assert.AreEqual(result, expected);
        }
开发者ID:zondario,项目名称:TelerikAcademy-Homeworks,代码行数:16,代码来源:PokerHandsCheckerTests.cs

示例14: FullHouseFalseTest

 public void FullHouseFalseTest()
 {
     List<Card> cards = new List<Card>(){
         new Card(CardFace.Nine, CardSuit.Hearts),
         new Card(CardFace.Jack, CardSuit.Spades),
         new Card(CardFace.Ace, CardSuit.Diamonds),
         new Card(CardFace.Nine, CardSuit.Clubs),
         new Card(CardFace.Jack, CardSuit.Hearts)
     };
     Hand hand = new Hand(cards.ToArray());
     PokerHandsChecker checker = new PokerHandsChecker();
     var excpected = false;
     var actual = checker.IsFullHouse(hand);
     Assert.AreEqual(excpected, actual);
 }
开发者ID:BorislavIvanov,项目名称:Telerik_Academy,代码行数:15,代码来源:PokerHandsCheckerTest.cs

示例15: TestPokerCheckerNotFullHouseHand

 public void TestPokerCheckerNotFullHouseHand()
 {
     List<ICard> cards = new List<ICard>();
     cards.Add(new Card(CardFace.Queen, CardSuit.Diamonds));
     cards.Add(new Card(CardFace.Queen, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Queen, CardSuit.Spades));
     cards.Add(new Card(CardFace.King, CardSuit.Diamonds));
     cards.Add(new Card(CardFace.Six, CardSuit.Clubs));
     var hand = new Hand(cards);
     var checker = new PokerHandsChecker();
     Assert.IsFalse(checker.IsFullHouse(hand));
 }
开发者ID:kalinalazarova1,项目名称:TelerikAcademy,代码行数:12,代码来源:PokerCheckerTest.cs


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