本文整理汇总了C#中Player.GetHand方法的典型用法代码示例。如果您正苦于以下问题:C# Player.GetHand方法的具体用法?C# Player.GetHand怎么用?C# Player.GetHand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.GetHand方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcWinner
public bool CalcWinner(Player a_player, Dealer a_dealer)
{
int[] cardScores = a_dealer.getCardScoreArray();
IEnumerable<Card> pHand = a_player.GetHand();
IEnumerable<Card> dHand = a_dealer.GetHand();
Card PlayerHighest = getHighestCardInHand(pHand, a_dealer);
Card DealerHighest = getHighestCardInHand(dHand, a_dealer);
if (cardScores[(int)PlayerHighest.GetValue()] == cardScores[(int)DealerHighest.GetValue()])
{
//if the second parameter is higher value then false is returned, aka player win.
return isHigherCardColorValue(DealerHighest.GetColor(), PlayerHighest.GetColor());
}
if (cardScores[(int)PlayerHighest.GetValue()] > cardScores[(int)DealerHighest.GetValue()])
{
//player won
return false;
}
else
{
//dealer won.
return true;
}
}
示例2: DoHit
public bool DoHit(Player a_dealer)
{
IEnumerable<Card> hand = a_dealer.GetHand();
//if the dealear has 17...
if (a_dealer.CalcScore() == g_hitLimit)
{
foreach (Card c in hand)
{
c.Show(true);
if (c.GetValue() == Card.Value.Ace)
{
/* Since Ace is valued 11, if the
* remainder of the hand equals
* 6, it's a soft 17, hit again.
*/
if (a_dealer.CalcScore() - 11 == 6)
{
return true;
}
}
}
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例3: DoHit
public bool DoHit(Player a_dealer)
{
int dealerScore = a_dealer.CalcScore();
IEnumerable<Card> dealerCards = a_dealer.GetHand();
// If dealers score is below 17, take a card
if (dealerScore < g_hitLimit)
{
return true;
}
/**
** If dealers score is 17, check for an ace and calculate score without ace
** If dealer has an ace and a score of 6 without the ace, subtract 10 from score
** to let ace represent 1 score instead of 11, and return result
*/
else if (dealerScore == g_hitLimit)
{
foreach (Card c in dealerCards)
{
if ((c.GetValue() == Card.Value.Ace) && (dealerScore - 11 == 6))
{
dealerScore -= 10;
}
}
return dealerScore < g_hitLimit;
}
// If dealers score is above 17, don't take a card
else
{
return false;
}
}
示例4: DoHit
public bool DoHit(Player a_dealer)
{
int score = 0;
bool hasAce = false;
IEnumerable<Card> hand = a_dealer.GetHand();
//if the dealear has 17...
if (a_dealer.CalcScore() == g_hitLimit)
{
foreach (Card c in hand)
{
c.Show(true);
//And one of the cards is an ace (normally valued 11)
if (c.GetValue() == Card.Value.Ace)
{
hasAce = true;
break;
}
}
}
//if hasAce is true,Ace is now valued 1 -otherwise normal value
score = (hasAce) ? a_dealer.CalcScore() - 10 : a_dealer.CalcScore();
return score < g_hitLimit;
}
示例5: DoHit
public bool DoHit(Player a_dealer)
{
if (a_dealer.CalcScore() == g_hitLimit)
{
return DealerHasAceInHand(a_dealer.GetHand());
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例6: DoHit
public bool DoHit(Player dealer)
{
int score = dealer.CalcScore();
if (score == HitLimit)
{
foreach (Card c in dealer.GetHand())
{
if (c.GetValue() == Card.Value.Ace)
{
return true;
}
}
}
return score < HitLimit;
}
示例7: DoHit
public bool DoHit(Player a_dealer)
{
List<Card> hand = a_dealer.GetHand().ToList();
bool hasAce = hand.Exists(c => c.GetValue() == Card.Value.Ace);
if (hasAce && (a_dealer.CalcScore() - 11 == 6))
{
return true;
}
else
{
return a_dealer.CalcScore() < g_hitLimit;
}
}
示例8: DoHit
public bool DoHit(Player a_dealer)
{
//Regel för soft17 för dealer
int d_score = a_dealer.CalcScore();
if (d_score == g_hitLimit)
{
foreach (Card c in a_dealer.GetHand())
{
if (c.GetValue() == Card.Value.Ace && d_score >= g_hitLimit)
{
d_score -= 10;
}
}
}
return d_score <= g_hitLimit;
}
示例9: DoHit
public bool DoHit(Player a_dealer)
{
int scoreDealer = a_dealer.CalcScore();
if (scoreDealer == g_hitLimit)
{
foreach (Card c in a_dealer.GetHand())
{
if (c.GetValue() == Card.Value.Ace && (scoreDealer - 11) == 6)
{
scoreDealer -= 10;
}
}
return scoreDealer < g_hitLimit;
}
else if (scoreDealer < g_hitLimit)
{
return true;
}
return false;
}