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


C# PokerHandsChecker.IsThreeOfAKind方法代碼示例

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


在下文中一共展示了PokerHandsChecker.IsThreeOfAKind方法的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: ThreeOfAKindHand

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

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

示例4: TestIsThreeOfAKindLessCards

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

示例5: IsThreeOfAKind_HandWithTwoPairs

        public void IsThreeOfAKind_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.IsThreeOfAKind(hand));
        }
開發者ID:Nottyy,項目名稱:TelerikAcademy,代碼行數:17,代碼來源:PokerHandsCheckerTestMethodIsThreeOfAKind.cs

示例6: NotThreeOfAkind

        public void NotThreeOfAkind()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.King, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Three, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Four, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Jack, CardSuit.Spades));
            cards.Add(new Card(CardFace.Ten, CardSuit.Clubs));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

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

            Assert.AreEqual(expected, result);
        }
開發者ID:bahtev,項目名稱:TelerikAcademy,代碼行數:18,代碼來源:PokerHandsCheckerIsThreeOfAKind.cs

示例7: IsNotThreeOfAKindTest

        public void IsNotThreeOfAKindTest()
        {
            Card aceClubs = new Card(CardFace.Ace, CardSuit.Clubs);
            Card queenClubs = new Card(CardFace.Queen, CardSuit.Clubs);
            Card kingHearts = new Card(CardFace.King, CardSuit.Hearts);
            Card jackClubs = new Card(CardFace.Jack, CardSuit.Clubs);
            Card tenOfClubs = new Card(CardFace.Ten, CardSuit.Clubs);

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

            cardsInHand.Add(tenOfClubs);
            cardsInHand.Add(aceClubs);
            cardsInHand.Add(jackClubs);
            cardsInHand.Add(queenClubs);
            cardsInHand.Add(kingHearts);

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

            Assert.IsFalse(handsChecker.IsThreeOfAKind(hand));
        }
開發者ID:hristo-iliev,項目名稱:TelerikHW,代碼行數:22,代碼來源:ThreeOfAKindTest.cs

示例8: IsThreeOfAKindTest

        public void IsThreeOfAKindTest()
        {
            Card twoOfHearts = new Card(CardFace.Two, CardSuit.Hearts);
            Card aceOfSpades = new Card(CardFace.Ace, CardSuit.Spades);
            Card threeOfHearts = new Card(CardFace.Ace, CardSuit.Hearts);
            Card kingOfClubs = 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(threeOfHearts);
            cardsInHand.Add(kingOfClubs);
            cardsInHand.Add(tenOfHearts);

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

            Assert.IsTrue(handsChecker.IsThreeOfAKind(hand));
        }
開發者ID:hristo-iliev,項目名稱:TelerikHW,代碼行數:22,代碼來源:ThreeOfAKindTest.cs

示例9: IsThreeOfAKindTestValidHandFullHouse

        public void IsThreeOfAKindTestValidHandFullHouse()
        {
            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.Queen, CardSuit.Clubs),
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Spades)
            });

            bool expectedIsThreeOfAKind = false;
            bool actual;
            actual = checker.IsThreeOfAKind(hand);
            Assert.AreEqual(expectedIsThreeOfAKind, actual);
        }
開發者ID:bankova,項目名稱:HighQualityCode,代碼行數:18,代碼來源:PokerHandsCheckerTest.cs

示例10: ThreeOfAKindCheckerShouldReturnTrueWhenTheHandIsValidThreeOfAKind

        public void ThreeOfAKindCheckerShouldReturnTrueWhenTheHandIsValidThreeOfAKind()
        {
            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.Two, CardSuit.Diamonds)
            });
            bool result = checker.IsThreeOfAKind(hand);
            bool expected = true;

            Assert.AreEqual(result, expected);
        }
開發者ID:zondario,項目名稱:TelerikAcademy-Homeworks,代碼行數:16,代碼來源:PokerHandsCheckerTests.cs

示例11: TestPokerCheckerThreeOfAKindHand

 public void TestPokerCheckerThreeOfAKindHand()
 {
     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.Seven, CardSuit.Clubs));
     cards.Add(new Card(CardFace.Six, CardSuit.Spades));
     var hand = new Hand(cards);
     var checker = new PokerHandsChecker();
     Assert.IsTrue(checker.IsThreeOfAKind(hand));
 }
開發者ID:kalinalazarova1,項目名稱:TelerikAcademy,代碼行數:12,代碼來源:PokerCheckerTest.cs

示例12: ThreeOfAKindFalseTest

 public void ThreeOfAKindFalseTest()
 {
     List<Card> cards = new List<Card>(){
         new Card(CardFace.Nine, CardSuit.Hearts),
         new Card(CardFace.Ten, CardSuit.Hearts),
         new Card(CardFace.Jack, CardSuit.Hearts),
         new Card(CardFace.Ace, CardSuit.Spades),
         new Card(CardFace.King, CardSuit.Hearts)
     };
     Hand hand = new Hand(cards.ToArray());
     PokerHandsChecker checker = new PokerHandsChecker();
     var excpected = false;
     var actual = checker.IsThreeOfAKind(hand);
     Assert.AreEqual(excpected, actual);
 }
開發者ID:BorislavIvanov,項目名稱:Telerik_Academy,代碼行數:15,代碼來源:PokerHandsCheckerTest.cs

示例13: TestIsThreeOfAKindShouldReturnTrue

        public void TestIsThreeOfAKindShouldReturnTrue()
        {
            var checker = new PokerHandsChecker();
            var cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Spades),
                new Card(CardFace.Two, CardSuit.Hearts),
                new Card(CardFace.Five, CardSuit.Hearts)
            };
            var hand = new Hand(cards);

            Assert.IsTrue(checker.IsThreeOfAKind(hand));
        }
開發者ID:Hri100v,項目名稱:Telerik-Academy,代碼行數:15,代碼來源:PockerHandsChecker_Combinations.cs

示例14: TestIsThreeOfAKindShouldReturnFalseWhenNotMatchingHandPassed_FullHouse

        public void TestIsThreeOfAKindShouldReturnFalseWhenNotMatchingHandPassed_FullHouse()
        {
            var checker = new PokerHandsChecker();
            var cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Spades),
                new Card(CardFace.Two, CardSuit.Hearts),
                new Card(CardFace.Ace, CardSuit.Hearts)
            };
            var hand = new Hand(cards);

            Assert.IsFalse(checker.IsThreeOfAKind(hand));
        }
開發者ID:Hri100v,項目名稱:Telerik-Academy,代碼行數:15,代碼來源:PockerHandsChecker_Combinations.cs

示例15: IsThreeOfAKindTest

 public void IsThreeOfAKindTest()
 {
     PokerHandsChecker target = new PokerHandsChecker();
     IList<ICard> cards = new List<ICard>();
     cards.Add(new Card(CardFace.Three, CardSuit.Spades));
     cards.Add(new Card(CardFace.Three, CardSuit.Diamonds));
     cards.Add(new Card(CardFace.Three, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Queen, CardSuit.Diamonds));
     cards.Add(new Card(CardFace.Two, CardSuit.Clubs));
     IHand hand = new Hand(cards);
     bool expected = true;
     bool actual;
     actual = target.IsThreeOfAKind(hand);
     Assert.AreEqual(expected, actual);
 }
開發者ID:kikooo52,項目名稱:TelerikAkademy,代碼行數:15,代碼來源:PokerHandsCheckerTest.cs


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