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


C# PokerHandsChecker.IsRoyalFlush方法代碼示例

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


在下文中一共展示了PokerHandsChecker.IsRoyalFlush方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: StaightFlushhtWithAceAsMin

        public void StaightFlushhtWithAceAsMin()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Two, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Three, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Four, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Five, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Ace, CardSuit.Diamonds));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

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

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

示例3: StraightFlushToKing

        public void StraightFlushToKing()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Nine, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Queen, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Ten, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Jack, CardSuit.Hearts));
            cards.Add(new Card(CardFace.King, CardSuit.Hearts));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

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

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

示例4: StraightNoFlush

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

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

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

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

示例5: TestRoyalFlush2

        public void TestRoyalFlush2()
        {
            IHand hand = new Hand("A♣ 10♣ K♣ Q♣ 2♣");

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsRoyalFlush(hand), "Royal Flush is not identified correctly.");
        }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:8,代碼來源:PokerHandsCheckerTest.cs


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