本文整理汇总了C#中IHand.SetPower方法的典型用法代码示例。如果您正苦于以下问题:C# IHand.SetPower方法的具体用法?C# IHand.SetPower怎么用?C# IHand.SetPower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHand
的用法示例。
在下文中一共展示了IHand.SetPower方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsFlush
public bool IsFlush(IHand hand)
{
int currentPower = Convert.ToInt32(hand.Power);
if (currentPower <= 5)
{
if (hand.CardsAreOfSameSuit())
{
if (!hand.CardsAreFollowing(false))
{
hand.SetPower(HandStrength.Flush);
return true;
}
}
}
return false;
}
示例2: IsFourOfAKind
public bool IsFourOfAKind(IHand hand)
{
int currentPower = Convert.ToInt32(hand.Power);
if (currentPower <= 8)
{
if(hand.Cards[0].Face == hand.Cards[1].Face &&
hand.Cards[0].Face == hand.Cards[2].Face &&
hand.Cards[0].Face == hand.Cards[3].Face)
{
hand.SetPower(HandStrength.FourOfAKind);
return true;
}
else if (hand.Cards[1].Face == hand.Cards[2].Face &&
hand.Cards[1].Face == hand.Cards[3].Face &&
hand.Cards[1].Face == hand.Cards[4].Face)
{
hand.SetPower(HandStrength.FourOfAKind);
return true;
}
}
return false;
}
示例3: IsTwoPair
public bool IsTwoPair(IHand hand)
{
int currentPower = Convert.ToInt32(hand.Power);
if (currentPower <= 3)
{
int cardCounter = 0;
for (int i = 0; i < hand.Cards.Count - 1; i++)
{
if (hand.Cards[i].Face == hand.Cards[i + 1].Face)
{
cardCounter++;
i++;
if(cardCounter == 2)
{
hand.SetPower(HandStrength.TwoPair);
return true;
}
}
}
}
return false;
}
示例4: IsThreeOfAKind
public bool IsThreeOfAKind(IHand hand)
{
int currentPower = Convert.ToInt32(hand.Power);
if (currentPower <= 4)
{
for (int i = 0; i < hand.Cards.Count - 2; i++)
{
bool isThreeOfAKind = false;
int cardCounter = 0;
for (int j = i + 1; j < hand.Cards.Count; j++)
{
if (hand.Cards[i].Face == hand.Cards[j].Face)
{
cardCounter++;
if (cardCounter == 2)
{
isThreeOfAKind = true;
}
}
}
if (isThreeOfAKind)
{
hand.SetPower(HandStrength.ThreeOfAKind);
return true;
}
}
}
return false;
}
示例5: IsStraight
public bool IsStraight(IHand hand)
{
int currentPower = Convert.ToInt32(hand.Power);
if (currentPower <= 6)
{
if (hand.CardsAreFollowing(false))
{
hand.SetPower(HandStrength.Straight);
return true;
}
}
return false;
}
示例6: IsOnePair
public bool IsOnePair(IHand hand)
{
int currentPower = Convert.ToInt32(hand.Power);
if (currentPower <= 2)
{
for (int i = 0; i < hand.Cards.Count; i++)
{
bool isOnePair = false;
for (int j = i + 1; j < hand.Cards.Count; j++)
{
if (hand.Cards[i].Face == hand.Cards[j].Face)
{
isOnePair = true;
}
}
if (isOnePair)
{
hand.SetPower(HandStrength.OnePair);
return true;
}
}
}
return false;
}
示例7: IsHighCard
public bool IsHighCard(IHand hand)
{
int currentPower = Convert.ToInt32(hand.Power);
if (currentPower <= 1)
{
hand.SetPower(HandStrength.HighCard);
return true;
}
return false;
}