本文整理汇总了C#中Hand.GetCards方法的典型用法代码示例。如果您正苦于以下问题:C# Hand.GetCards方法的具体用法?C# Hand.GetCards怎么用?C# Hand.GetCards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hand
的用法示例。
在下文中一共展示了Hand.GetCards方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetermineStrongestHand
public Hand DetermineStrongestHand(Hand handOne, Hand handTwo)
{
Hand bestHand = null;
var handSize = handOne.GetCards().Count;
handOne.ArrangeCardsHighToLow();
handTwo.ArrangeCardsHighToLow();
var kickerBreaker = new GroupsOfCardsOfSameValueTieBreaker(handOne, handTwo);
bestHand = kickerBreaker.DetermineStrongestHand(1);
for (var i = 0; i < handSize; i++)
{
if (handOne.GetCards()[i].GetCardValue() > handTwo.GetCards()[i].GetCardValue())
{
bestHand = handOne;
break;
}
if (handTwo.GetCards()[i].GetCardValue() > handOne.GetCards()[i].GetCardValue())
{
bestHand = handTwo;
break;
}
}
return bestHand;
}
示例2: IsAceLowStraight
private static bool IsAceLowStraight(Hand hand)
{
return (hand.GetCards()[0].GetCardValue() == Value.Two
&& hand.GetCards()[1].GetCardValue() == Value.Three
&& hand.GetCards()[2].GetCardValue() == Value.Four
&& hand.GetCards()[3].GetCardValue() == Value.Five
&& hand.GetCards()[4].GetCardValue() == Value.Ace);
}
示例3: FindHighestCard
private Value FindHighestCard(Hand hand)
{
var sortedHand = hand.GetCards().OrderByDescending(c => c.GetCardValue()).ToList();
var highestCardValue = sortedHand[0].GetCardValue();
var secondHighestCardValue = sortedHand[1].GetCardValue();
if (highestCardValue == Value.Ace && secondHighestCardValue == Value.Five)
{
highestCardValue = Value.Five;
}
return highestCardValue;
}
示例4: DetermineStrongestHand
public static Hand DetermineStrongestHand(Hand handOne, Hand handTwo, int multipleRequired)
{
Hand bestHand = null;
for (var cardValue = Value.Ace; cardValue >= Value.Two; cardValue--)
{
var handOneCountOfCard = handOne.GetCards().Count(obj => obj.GetCardValue() == cardValue);
var handTwoCountOfCard = handTwo.GetCards().Count(obj => obj.GetCardValue() == cardValue);
if (handOneCountOfCard == multipleRequired && handTwoCountOfCard != multipleRequired)
{
bestHand = handOne;
break;
}
if (handTwoCountOfCard == multipleRequired && handOneCountOfCard != multipleRequired)
{
bestHand = handTwo;
break;
}
}
return bestHand;
}