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


C# PokerHandsChecker.CheckHand方法代碼示例

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


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

示例1: TestForCompareEqual

        public void TestForCompareEqual()
        {
            IHand straightHand1 = new Hand(new List<ICard>() {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Hearts),
                new Card(CardFace.Four, CardSuit.Diamonds),
            });

            IHand straightHand = new Hand(new List<ICard>() {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Hearts),
                new Card(CardFace.Four, CardSuit.Diamonds),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(straightHand);
            checker.CheckHand(straightHand1);
            Assert.AreEqual(0, checker.CompareHands(straightHand, straightHand1));
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:23,代碼來源:HandsTester.cs

示例2: TestForCompareGreater

        public void TestForCompareGreater()
        {
            IHand highCardHand = new Hand(new List<ICard>() {
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Hearts),
                new Card(CardFace.Five, CardSuit.Diamonds),
            });

            IHand straightHand = new Hand(new List<ICard>() {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Hearts),
                new Card(CardFace.Four, CardSuit.Diamonds),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(straightHand);
            checker.CheckHand(highCardHand);
            Assert.AreEqual(1, checker.CompareHands(straightHand, highCardHand));
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:23,代碼來源:HandsTester.cs

示例3: StraightFlush

        public void StraightFlush()
        {
            IHand hand = new Hand(new List<ICard>() {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Clubs),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Clubs),
                new Card(CardFace.Eight, CardSuit.Clubs),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(hand);
            Assert.AreEqual(HandStrength.StraightFlush, hand.Power);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:14,代碼來源:HandsTester.cs

示例4: Main

        static void Main()
        {
            IHand hand = new Hand(new List<ICard>() {
                new Card(CardFace.Six, CardSuit.Spades),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Four, CardSuit.Hearts),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Clubs),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(hand);
            Console.WriteLine(hand.Power);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:14,代碼來源:PokerExample.cs

示例5: TestThreeOfAKind

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

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(hand);
            Assert.AreEqual(HandStrength.ThreeOfAKind, hand.Power);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:14,代碼來源:HandsTester.cs

示例6: TestForTwoSameFaces

        public void TestForTwoSameFaces()
        {
            IHand hand = new Hand(new List<ICard>() {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Clubs),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(hand);
            Assert.AreEqual(false, hand.IsValid);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:14,代碼來源:HandsTester.cs

示例7: TestForRoyal

        public void TestForRoyal()
        {
            IHand 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.Ten, CardSuit.Clubs),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(hand);
            Assert.AreEqual(HandStrength.RoyalFlush, hand.Power);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:14,代碼來源:HandsTester.cs

示例8: TestForOnePair

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

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(hand);
            Assert.AreEqual(HandStrength.OnePair, hand.Power);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:14,代碼來源:HandsTester.cs

示例9: TestForFlush

        public void TestForFlush()
        {
            IHand hand = new Hand(new List<ICard>() {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Clubs),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Clubs),
            });

            IPokerHandsChecker checker = new PokerHandsChecker();
            checker.CheckHand(hand);
            Assert.AreEqual(HandStrength.Flush, hand.Power);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:14,代碼來源:HandsTester.cs


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