本文整理汇总了C#中Player.CalcScore方法的典型用法代码示例。如果您正苦于以下问题:C# Player.CalcScore方法的具体用法?C# Player.CalcScore怎么用?C# Player.CalcScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.CalcScore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例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)
{
if (a_dealer.CalcScore() == g_hitLimit)
{
return DealerHasAceInHand(a_dealer.GetHand());
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例4: IsDealerWinner
public bool IsDealerWinner(Player player, Player dealer, int maxScore)
{
if(player.CalcScore() > maxScore)
{
return true;
} else if(dealer.CalcScore() > maxScore)
{
return false;
}
return dealer.CalcScore() >= player.CalcScore();
}
示例5: IfEqual
public bool IfEqual(Player a_player, Dealer a_dealer)
{
const int g_hitLimit = 17;
if (a_player.CalcScore() >= g_hitLimit && a_player.CalcScore() == a_dealer.CalcScore())
{
return true;
}
return false;
}
开发者ID:mc22ft,项目名称:Objektorienterad-analys-och-design-med-UML,代码行数:11,代码来源:DealerWinIfEqualStratergy.cs
示例6: Win
public bool Win(Dealer a_dealer, Player a_player, int maxScore)
{
if (a_player.CalcScore() > maxScore)
{
return true;
}
else if (a_dealer.CalcScore() > maxScore)
{
return false;
}
return a_player.CalcScore() >= a_dealer.CalcScore();
}
示例7: winner
public bool winner(Player a_player, Player a_dealer, int maxScore)
{
if (a_player.CalcScore() > maxScore)
{
return true;
}
else if (a_dealer.CalcScore() > maxScore)
{
return false;
}
return !(a_dealer.CalcScore() >= a_player.CalcScore());
}
示例8: IsDealerWinner
public bool IsDealerWinner(Player m_dealer, Player m_player)
{
if (m_player.CalcScore() > g_maxScore)
{
return true;
}
else if (m_dealer.CalcScore() > g_maxScore)
{
return false;
}
return m_dealer.CalcScore() >= m_player.CalcScore();
}
示例9: Winner
public bool Winner(Player a_player, Dealer a_dealer)
{
if (a_player.CalcScore() > g_maxScore)
{
return true;
}
else if (a_dealer.CalcScore() > g_maxScore)
{
return false;
}
return (a_dealer.CalcScore() >= a_player.CalcScore());
}
示例10: IsDealerWinner
public bool IsDealerWinner(Dealer a_dealer, Player a_player,int g_maxScore)
{
if (a_player.CalcScore() > g_maxScore)
{
return true;
}
else if (a_dealer.CalcScore() > g_maxScore)
{
return false;
}
return a_dealer.CalcScore() >= a_player.CalcScore();
}
示例11: IsDealerWinner
public bool IsDealerWinner(Dealer a_dealer, Player a_player)
{
if (a_player.CalcScore() > a_dealer.GetMaxScore())
{
return true;
}
else if (a_dealer.CalcScore() > a_dealer.GetMaxScore())
{
return false;
}
return a_dealer.CalcScore() >= a_player.CalcScore();
}
示例12: IsDealerWinner
public bool IsDealerWinner(Player a_player, Dealer a_dealer, int maxScore)
{
if (a_player.CalcScore() > maxScore)
{
return true;
}
else if (a_dealer.CalcScore() > maxScore)
{
return false;
}
return a_dealer.CalcScore() > a_player.CalcScore();
}
示例13: dealerWins
public bool dealerWins(Player a_player, Player a_dealer, int maxScore)
{
// if player or dealer exceeds the maxscore
if (a_player.CalcScore() > maxScore)
{
return true;
}
else if (a_dealer.CalcScore() > maxScore)
{
return false;
}
// else favor the player
return !(a_dealer.CalcScore() >= a_player.CalcScore());
}
示例14: 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;
}
}
示例15: 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;
}
}