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


C# PokerHandsChecker.IsHighCard方法代碼示例

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


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

        public void HighCardTrueTest()
        {
            var card1 = new Card(CardFace.King, CardSuit.Hearts);
            var card2 = new Card(CardFace.Five, CardSuit.Spades);
            var card3 = new Card(CardFace.Seven, CardSuit.Diamonds);
            var card4 = new Card(CardFace.Ten, CardSuit.Clubs);
            var card5 = new Card(CardFace.Two, CardSuit.Spades);

            var cards = new List<ICard>();
            cards.Add(card1);
            cards.Add(card2);
            cards.Add(card3);
            cards.Add(card4);
            cards.Add(card5);

            // ♣
            // ♦
            // ♥
            // ♠

            Hand hand = new Hand(cards);

            bool expected = true;
            PokerHandsChecker checker = new PokerHandsChecker();
            bool actual = checker.IsHighCard(hand);
            Assert.AreEqual(expected, actual);
        }
開發者ID:abaditsegay,項目名稱:SVN,代碼行數:27,代碼來源:PokerHandsTests.cs

示例3: NotHighCardHand

        public void NotHighCardHand()
        {
            var hand = new Hand(new List<ICard>() {
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Spades),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.Six, CardSuit.Spades)
            });

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

示例4: TestIsHighCardLessCards

 public void TestIsHighCardLessCards()
 {
     Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds);
     Card cardTwo = new Card(CardFace.Four, CardSuit.Hearts);
     Card cardThree = new Card(CardFace.Jack, CardSuit.Clubs);
     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 isHighCard = poker.IsHighCard(hand);
     Assert.AreEqual(false, isHighCard, "IsHighCard() method in class PokerHandsChecker is not working correctly.");
 }
開發者ID:theshaftman,項目名稱:Telerik-Academy,代碼行數:14,代碼來源:IsHighCardTest.cs

示例5: IsHighCardTest

        public void IsHighCardTest()
        {
            Hand hand = new Hand(new List<ICard>() 
            { 
                new Card(CardFace.Ace, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Two, CardSuit.Spades)
            });

            PokerHandsChecker checker = new PokerHandsChecker();
            bool actual = checker.IsHighCard(hand);
            bool expected = true; 
            Assert.AreEqual(expected, actual);
        }
開發者ID:NikolayKostadinov,項目名稱:Homeworks,代碼行數:16,代碼來源:PokerHandsCheckerTest.cs

示例6: TestHighCard1

        public void TestHighCard1()
        {
            ICard[] cards = new ICard[5]
            {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.Two, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Spades),
                new Card(CardFace.Nine, CardSuit.Clubs)
            };

            IHand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsTrue(checker.IsHighCard(hand), "High card is not identified correctly.");
        }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:17,代碼來源:PokerHandsCheckerTest.cs

示例7: IsHighCard_AceAsHightCard

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

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsTrue(checker.IsHighCard(hand));
        }
開發者ID:Nottyy,項目名稱:TelerikAcademy,代碼行數:17,代碼來源:PokerHandsCheckerTestMethodIsHighCard.cs

示例8: IsHighCard_ThreeOfAces

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

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsHighCard(hand));
        }
開發者ID:Nottyy,項目名稱:TelerikAcademy,代碼行數:17,代碼來源:PokerHandsCheckerTestMethodIsHighCard.cs

示例9: PairOfAces

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

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

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

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

示例10: HighCardTen

        public void HighCardTen()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Two, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Ten, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Seven, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Four, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Five, CardSuit.Spades));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            bool result = checker.IsHighCard(hand);
            bool expected = true;

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

示例11: IsNotHighCardTest

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

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

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

示例12: IsHighCardTest

        public void IsHighCardTest()
        {
            Card aceClubs = new Card(CardFace.Ace, CardSuit.Clubs);
            Card kingClubs = new Card(CardFace.King, CardSuit.Clubs);
            Card twoHearts = new Card(CardFace.Two, 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(kingClubs);
            cardsInHand.Add(twoHearts);

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

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

示例13: TestIsHighCardShoudReturnTrue

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

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

示例14: TestIsHighCardShoudReturnFalseWhenNotMatchingHandPassed_OnePair

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

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

示例15: IsNotHighCardTest

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


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