本文整理汇总了C#中Poker.PokerHandsChecker.IsOnePair方法的典型用法代码示例。如果您正苦于以下问题:C# PokerHandsChecker.IsOnePair方法的具体用法?C# PokerHandsChecker.IsOnePair怎么用?C# PokerHandsChecker.IsOnePair使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poker.PokerHandsChecker
的用法示例。
在下文中一共展示了PokerHandsChecker.IsOnePair方法的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));
}
示例2: 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.IsOnePair(hand));
Console.WriteLine(checker.IsTwoPair(hand));
var card1 = new Card(CardFace.Jack, CardSuit.Clubs);
var card2 = new Card(CardFace.Nine, CardSuit.Diamonds);
var card3 = new Card(CardFace.Four, CardSuit.Spades);
var card4 = new Card(CardFace.Two, CardSuit.Hearts);
var card5 = new Card(CardFace.Queen, CardSuit.Hearts);
var hand2 = new Hand(new List<ICard> { card1, card2, card3, card4, card5 });
Console.WriteLine(hand2);
}
示例3: Main
internal 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.IsOnePair(hand));
Console.WriteLine(checker.IsTwoPairs(hand));
int a = 5;
int b = 6;
Console.WriteLine(b.CompareTo(a));
}
示例4: Main
static void Main()
{
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Black;
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),
});
IHand hand2 = new Hand(new List<ICard>()
{
new Card(CardFace.Two, CardSuit.Clubs),
new Card(CardFace.Two, CardSuit.Diamonds),
new Card(CardFace.Three, CardSuit.Hearts),
new Card(CardFace.Three, CardSuit.Spades),
new Card(CardFace.Two, CardSuit.Hearts),
});
Console.WriteLine(hand);
IPokerHandsChecker checker = new PokerHandsChecker();
Console.WriteLine("Is valid hand: " + checker.IsValidHand(hand));
Console.WriteLine("Is one pair: " + checker.IsOnePair(hand));
Console.WriteLine("Is two pairs: " + checker.IsTwoPair(hand));
Console.WriteLine(Environment.NewLine + "Compare hands. 1 for first hand. -1 for second hand. 0 for same hands");
Console.WriteLine("Hand: {0}, Hand2: {1} Compare: {2}", hand, hand2, checker.CompareHands(hand, hand2));
}
示例5: Main
public static void Main()
{
XmlConfigurator.Configure();
Log.Info("Info logging");
try
{
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.Jack, CardSuit.Diamonds),
new Card(CardFace.King, CardSuit.Hearts),
new Card(CardFace.Ten, CardSuit.Spades),
new Card(CardFace.Queen, CardSuit.Diamonds),
});
Console.WriteLine(hand);
IPokerHandsChecker checker = new PokerHandsChecker();
Console.WriteLine("Valid hand? : {0}", checker.IsValidHand(hand));
Console.WriteLine("Is Straight : {0}", checker.IsStraight(hand));
Console.WriteLine("Is one pair : {0}", checker.IsOnePair(hand));
Console.WriteLine("Is two pair : {0}", checker.IsTwoPair(hand));
}
catch (Exception e)
{
Log.Error("This is my error", e);
}
}
示例6: OnePairHand
public void OnePairHand()
{
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.Nine, CardSuit.Clubs)
});
var checker = new PokerHandsChecker();
Assert.IsTrue(checker.IsOnePair(hand));
}
示例7: TestIsOnePairLessCards
public void TestIsOnePairLessCards()
{
Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds);
Card cardTwo = new Card(CardFace.Two, CardSuit.Hearts);
Card cardThree = new Card(CardFace.Ten, 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 isOnePair = poker.IsOnePair(hand);
Assert.AreEqual(false, isOnePair, "IsOnePair() method in class PokerHandsChecker is not working correctly.");
}
示例8: TestIsOnePairWithOnlyOnePairAtTheEnd
public void TestIsOnePairWithOnlyOnePairAtTheEnd()
{
PokerHandsChecker handChecker = new PokerHandsChecker();
Hand hand = new Hand(new List<ICard>()
{
new Card(CardFace.Six, CardSuit.Diamonds),
new Card(CardFace.Three, CardSuit.Diamonds),
new Card(CardFace.Four, CardSuit.Hearts),
new Card(CardFace.Two, CardSuit.Diamonds),
new Card(CardFace.Two, CardSuit.Spades)
});
bool result = handChecker.IsOnePair(hand);
Assert.AreEqual(true, result);
}
示例9: TestIsOnePair
public void TestIsOnePair()
{
Hand hand = new Hand(new List<ICard>{
new Card(CardFace.Two, CardSuit.Hearts),
new Card(CardFace.Two, CardSuit.Diamonds),
new Card(CardFace.Four, CardSuit.Diamonds),
new Card(CardFace.Ace, CardSuit.Diamonds),
new Card(CardFace.King, CardSuit.Diamonds),
});
PokerHandsChecker checker = new PokerHandsChecker();
var excpected = true;
var actual = checker.IsOnePair(hand);
Assert.AreEqual(excpected, actual);
}
示例10: IsOnePair_HandWithThreeOfAKind
public void IsOnePair_HandWithThreeOfAKind()
{
IList<ICard> cards = new List<ICard>
{
new Card(CardFace.Ace, CardSuit.Diamonds),
new Card(CardFace.Queen, CardSuit.Hearts),
new Card(CardFace.Six, 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.IsOnePair(hand));
}
示例11: Main
static void Main()
{
ICard card = new Card(CardFace.Ace, CardSuit.Clubs);
Console.WriteLine(card);
IHand hand = new Hand(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.IsOnePair(hand));
Console.WriteLine(checker.IsTwoPair(hand));
}
示例12: Main
static void Main()
{
ICard[] cards = new ICard[]
{
new Card(CardFace.Queen, CardSuit.Hearts),
new Card(CardFace.Queen, CardSuit.Spades),
new Card(CardFace.Ten, CardSuit.Hearts),
new Card(CardFace.Queen, CardSuit.Diamonds),
new Card(CardFace.Queen, CardSuit.Clubs)
};
IHand hand = new Hand(cards);
IPokerHandsChecker checker = new PokerHandsChecker();
Console.WriteLine(checker.IsValidHand(hand));
Console.WriteLine(checker.IsOnePair(hand));
Console.WriteLine(checker.IsTwoPair(hand));
}
示例13: twoJacksAndTwoKings
public void twoJacksAndTwoKings()
{
IList<ICard> cards = new List<ICard>();
cards.Add(new Card(CardFace.Jack, CardSuit.Clubs));
cards.Add(new Card(CardFace.King, CardSuit.Diamonds));
cards.Add(new Card(CardFace.Seven, CardSuit.Hearts));
cards.Add(new Card(CardFace.King, CardSuit.Spades));
cards.Add(new Card(CardFace.Jack, CardSuit.Diamonds));
Hand hand = new Hand(cards);
PokerHandsChecker checker = new PokerHandsChecker();
bool result = checker.IsOnePair(hand);
bool expected = false;
Assert.AreEqual(expected, result);
}
示例14: ThreeQueens
public void ThreeQueens()
{
IList<ICard> cards = new List<ICard>();
cards.Add(new Card(CardFace.Queen, CardSuit.Clubs));
cards.Add(new Card(CardFace.Queen, CardSuit.Diamonds));
cards.Add(new Card(CardFace.Queen, CardSuit.Hearts));
cards.Add(new Card(CardFace.Five, CardSuit.Spades));
cards.Add(new Card(CardFace.Ace, CardSuit.Clubs));
Hand hand = new Hand(cards);
PokerHandsChecker checker = new PokerHandsChecker();
bool result = checker.IsOnePair(hand);
bool expected = false;
Assert.AreEqual(expected, result);
}
示例15: Main
public 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("Is valid hand ? - {0}", checker.IsValidHand(hand));
Console.WriteLine("Has one pair ? - {0}", checker.IsOnePair(hand));
Console.WriteLine("Has two pair ? - {0}", checker.IsTwoPair(hand));
}