本文整理汇总了C#中Hand.isBetter方法的典型用法代码示例。如果您正苦于以下问题:C# Hand.isBetter方法的具体用法?C# Hand.isBetter怎么用?C# Hand.isBetter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hand
的用法示例。
在下文中一共展示了Hand.isBetter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: advanceState
public void advanceState()
{
if(state == 0)
{
deck.drawNext(PlayerCard1.GetComponent<Card>());
deck.drawNext(PlayerCard2.GetComponent<Card>());
PlayerCard1.GetComponent<Card>().display = true;
PlayerCard2.GetComponent<Card>().display = true;
state = 1;
}
else if(state == 1)
{
deck.drawNext(FlopCard1.GetComponent<Card>());
deck.drawNext(FlopCard2.GetComponent<Card>());
deck.drawNext(FlopCard3.GetComponent<Card>());
FlopCard1.GetComponent<Card>().display = true;
FlopCard2.GetComponent<Card>().display = true;
FlopCard3.GetComponent<Card>().display = true;
state = 2;
}
else if (state == 2)
{
deck.drawNext(TurnCard.GetComponent<Card>());
TurnCard.GetComponent<Card>().display = true;
state = 3;
}
else if (state == 3)
{
deck.drawNext(RiverCard.GetComponent<Card>());
RiverCard.GetComponent<Card>().display = true;
state = 4;
}
else if (state == 4)
{
Hand bestHand = null;
Card[] allCards = new Card[7];
allCards[0] = PlayerCard1.GetComponent<Card>();
allCards[1] = PlayerCard2.GetComponent<Card>();
allCards[2] = FlopCard1.GetComponent<Card>();
allCards[3] = FlopCard2.GetComponent<Card>();
allCards[4] = FlopCard3.GetComponent<Card>();
allCards[5] = TurnCard.GetComponent<Card>();
allCards[6] = RiverCard.GetComponent<Card>();
for (int i = 0; i < 7; i ++ )
{
for(int j = 0; j < i; j ++)
{
Card[] handCards = new Card[5];
int ix = 0;
for(int k = 0; k < 7; k ++)
{
if(k != i && k != j)
{
handCards[ix] = allCards[k];
ix++;
}
}
Hand newHand = new Hand(handCards);
if(bestHand == null || newHand.isBetter(bestHand) > 0)
{
bestHand = newHand;
}
}
}
Debug.Log(bestHand.print());
state = 5;
}
else
{
PlayerCard1.GetComponent<Card>().display = false;
PlayerCard2.GetComponent<Card>().display = false;
FlopCard1.GetComponent<Card>().display = false;
FlopCard2.GetComponent<Card>().display = false;
FlopCard3.GetComponent<Card>().display = false;
TurnCard.GetComponent<Card>().display = false;
RiverCard.GetComponent<Card>().display = false;
state = 0;
deck = new Deck();
}
}