當前位置: 首頁>>代碼示例>>C#>>正文


C# PokerHandsChecker.IsFourOfAKind方法代碼示例

本文整理匯總了C#中Poker.PokerHandsChecker.IsFourOfAKind方法的典型用法代碼示例。如果您正苦於以下問題:C# PokerHandsChecker.IsFourOfAKind方法的具體用法?C# PokerHandsChecker.IsFourOfAKind怎麽用?C# PokerHandsChecker.IsFourOfAKind使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Poker.PokerHandsChecker的用法示例。


在下文中一共展示了PokerHandsChecker.IsFourOfAKind方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

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

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

        public void IsFourOfAKindTest()
        {
            Hand pokerHand = new Hand(new List<ICard>(){ 
                                new Card(CardFace.Ace, CardSuit.Hearts),
                                new Card(CardFace.Jack, CardSuit.Diamonds),
                                new Card(CardFace.Jack, CardSuit.Spades),
                                new Card(CardFace.Jack, CardSuit.Clubs), 
                                new Card(CardFace.Jack, CardSuit.Hearts)});

            PokerHandsChecker checker = new PokerHandsChecker();
            Assert.AreEqual(true, checker.IsFourOfAKind(pokerHand));
        }
開發者ID:BorislavIvanov,項目名稱:Telerik_Academy,代碼行數:12,代碼來源:PokerHandsCheckerTest.cs

示例4: TestForFourOfAKind

 public void TestForFourOfAKind()
 {
     IList<ICard> cardList = new List<ICard>();
     cardList.Add(new Card(CardFace.King, CardSuit.Spades));
     cardList.Add(new Card(CardFace.King, CardSuit.Hearts));
     cardList.Add(new Card(CardFace.King, CardSuit.Diamonds));
     cardList.Add(new Card(CardFace.King, CardSuit.Clubs));
     cardList.Add(new Card(CardFace.Ten, CardSuit.Hearts));
     var hand = new Hand(cardList);
     var handChecker = new PokerHandsChecker();
     Assert.AreEqual(true, handChecker.IsFourOfAKind(hand));
 }
開發者ID:hrist0stoichev,項目名稱:Telerik-Homeworks,代碼行數:12,代碼來源:PokerHandsCheckerTests.cs

示例5: TestForOfKindWithValidCards

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

            IPokerHandsChecker checker = new PokerHandsChecker();
            Assert.AreEqual(true, checker.IsFourOfAKind(hand));
        }
開發者ID:VDGone,項目名稱:TelerikAcademy-2,代碼行數:13,代碼來源:TestPokerHandChecker.cs

示例6: ExpectIsFourOfAKindToReturnTrueWhenThereIsFourOfAKindCombinationTest3

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

            Hand hand = new Hand(cards);
            PokerHandsChecker checker = new PokerHandsChecker();
            Assert.AreEqual(true, checker.IsFourOfAKind(hand));
        }
開發者ID:Rostech,項目名稱:TelerikAcademyHomeworks,代碼行數:13,代碼來源:PokerHandsChecker_IsFourOfAKindTest.cs

示例7: TestForOfKindWithInvalidCards

        public void TestForOfKindWithInvalidCards()
        {
            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.IsFourOfAKind(hand));
        }
開發者ID:VDGone,項目名稱:TelerikAcademy-2,代碼行數:13,代碼來源:TestPokerHandChecker.cs

示例8: NotFourOfAKindHand

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

            var checker = new PokerHandsChecker();
            Assert.IsFalse(checker.IsFourOfAKind(hand));
        }
開發者ID:Termininja,項目名稱:TelerikAcademy,代碼行數:13,代碼來源:IsFourOfAKindHandTests.cs

示例9: IsFourOfAKind_CheckWithout4CardsOfSameKind

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

            var hand = new Hand(cards);
            var pokerHandsChecker = new PokerHandsChecker();
            Assert.IsFalse(pokerHandsChecker.IsFourOfAKind(hand));
        }
開發者ID:androidejl,項目名稱:Telerik,代碼行數:14,代碼來源:PokerHandsCheckerTests.cs

示例10: IsFourOfAKind_FourOfAKindWhithValidHand_ShouldReturnFalse

        public void IsFourOfAKind_FourOfAKindWhithValidHand_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.IsFourOfAKind(hand));
        }
開發者ID:glifada,項目名稱:TelerikAcademy,代碼行數:14,代碼來源:PokerHandsCheckerTests.cs

示例11: IsFourOfAKind_CheckWith4CardsOfSameKind

        public void IsFourOfAKind_CheckWith4CardsOfSameKind()
        {
            var cards = new List<ICard>() {
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Hearts),
                new Card(CardFace.Two, CardSuit.Spades),
                new Card(CardFace.Ace, CardSuit.Clubs)
            };

            var hand = new Hand(cards);
            var pokerHandsChecker = new PokerHandsChecker();
            Assert.IsTrue(pokerHandsChecker.IsFourOfAKind(hand));
        }
開發者ID:androidejl,項目名稱:Telerik,代碼行數:14,代碼來源:PokerHandsCheckerTests.cs

示例12: TestIsFourOfAKindLessCards

 public void TestIsFourOfAKindLessCards()
 {
     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 isFourOfAKind = poker.IsFourOfAKind(hand);
     Assert.AreEqual(false, isFourOfAKind, "IsFourOfAKind() method in class PokerHandsChecker is not working correctly.");
 }
開發者ID:danielkaradaliev,項目名稱:TelerikAcademyAssignments,代碼行數:14,代碼來源:IsFourOfAKindTests.cs

示例13: IsFourOfAKindTrue

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

            PokerHandsChecker checkHand = new PokerHandsChecker();
            bool isValidHand = checkHand.IsFourOfAKind(hand);
            Assert.IsTrue(isValidHand);
        }
開發者ID:eandmir,項目名稱:KPK,代碼行數:15,代碼來源:PokerHandsCheckerTests.cs

示例14: TestFourOfAKindIncorrectHand_TwoSameCards

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

            Hand hand = new Hand(cards);
            PokerHandsChecker checker = new PokerHandsChecker();
            Assert.IsFalse(checker.IsFourOfAKind(hand));
        }
開發者ID:hristo11111,項目名稱:TelerikAcademy-HristoBratanov,代碼行數:15,代碼來源:FourOfAKindTests.cs

示例15: FourOfAKindFiveCards_FourWithSameFace_IsTrue

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

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsTrue(checker.IsFourOfAKind(hand));
        }
開發者ID:Bvaptsarov,項目名稱:Homework,代碼行數:15,代碼來源:PokerHandsCheckerTest.cs


注:本文中的Poker.PokerHandsChecker.IsFourOfAKind方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。