本文整理汇总了C#中model.CalcScore方法的典型用法代码示例。如果您正苦于以下问题:C# model.CalcScore方法的具体用法?C# model.CalcScore怎么用?C# model.CalcScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model.CalcScore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoHit
public bool DoHit(model.Player a_dealer)
{
int[] cardScores = a_dealer.getCardScoreArray();
total = 0;
if (a_dealer.CalcScore() < 17)
{
return true;
}
if (a_dealer.CalcScore() == 17){
foreach (Card c in a_dealer.GetHand())
{
if (c.GetValue() != Card.Value.Ace)
{
total += cardScores[(int)c.GetValue()];
}
}
//if this is true a soft 17 is active.
if (total <= 6)
{
return true;
}
}
return false;
}
示例2: DoHit
public bool DoHit(model.Player a_dealer)
{
if (a_dealer.CalcScore() == g_hitLimit)
{
int otherValue = 0;
bool aceFound = false;
int[] cardScores = new int[(int)model.Card.Value.Count] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11 };
foreach (Card card in a_dealer.GetHand())
{
if (card.GetValue() == Card.Value.Ace && !aceFound)
{
aceFound = true;
} else {
otherValue += cardScores[(int)card.GetValue()];
if (otherValue > 6)
{
return false;
}
}
}
if (otherValue == 6 && aceFound)
{
return true;
}
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例3: DoHit
public bool DoHit(model.Player a_dealer)
{
var cards = a_dealer.GetHand();
// Check if limit has reached....
if (a_dealer.CalcScore() == g_hitLimit)
{
foreach (var card in cards)
{
// Must hit if ace in hand. Because score IS 17!
//Ace turns into 1 score instead
if (card.GetValue() == Card.Value.Ace)
{
return true;
}
}
}
// No special circumstances....
if (a_dealer.CalcScore() < g_hitLimit)
{
return true;
}
else
{
return false;
}
}
示例4: DoHit
public bool DoHit(model.Player a_dealer)
{
if (a_dealer.CalcScore() == g_hitLimit)
{
return DealerHasAce(a_dealer.GetHand());
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例5: DoIsDealerWinner
public bool DoIsDealerWinner(model.Player a_dealer, model.Player a_player)
{
if (a_player.CalcScore() > g_maxScore)
{
return true;
}
else if (a_dealer.CalcScore() > g_maxScore)
{
return false;
}
return a_dealer.CalcScore() > a_player.CalcScore();
}
示例6: DoHit
public bool DoHit(model.Player a_dealer)
{
if(a_dealer.CalcScore() < g_hitLimit)
{
return true;
}
//checks to see if the amount of ace is atleast of half the dealers cards to make sure the dealer doesnt hit at a hard 17. Example ace + 6 + 10
else if (a_dealer.GetHand().Count(x => x.GetValue() == Card.Value.Ace)*2 >= a_dealer.GetHand().Count() && a_dealer.CalcScore() <= g_hitLimit)
{
return true;
}
return false;
}
示例7: IsDealerWinner
public bool IsDealerWinner(model.Player a_player, model.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();
}
示例8: DoHit
public bool DoHit(model.Player a_dealer)
{
int a = a_dealer.CalcScore();
if (a == 17)
{
foreach (Card c in a_dealer.GetHand())
{
if (c.GetValue() == Card.Value.Ace)
{
return true;
}
}
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例9: DoHit
public bool DoHit(model.Player a_dealer)
{
int score = a_dealer.CalcScore(false); // parameter false means don't calcScore using Ace as 1 but only 11
if (score == g_hitLimit)
{
foreach (Card c in a_dealer.GetHand())
{
if (c.GetValue() == Card.Value.Ace)
{
return true;
}
}
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例10: DoHit
public bool DoHit(model.Player a_dealer)
{
int score = a_dealer.CalcScore();
if (score < g_hitLimit)
{
return true;
}
if (score == g_hitLimit)
{
foreach (Card c in a_dealer.GetHand())
{
//If Ace is in the hand, checks if score without Ace is 6
if ((c.GetValue() == Card.Value.Ace) && (score - 11 == 6))
{
score -= 10;
}
}
return score < g_hitLimit;
}
return false;
}
示例11: DoHit
//Hit if score is 17 or less
public bool DoHit(model.Player a_dealer)
{
var cards = a_dealer.GetHand();
if(a_dealer.CalcScore() == g_hitLimit)
{
foreach(Card card in cards)
{
if (card.GetValue() == Card.Value.Ace && a_dealer.CalcScore() - 11 == 6)
{
return true;
}
}
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例12: DoHit
public bool DoHit(model.Player a_dealer)
{
if(a_dealer.CalcScore() == g_hitLimit)
{
IEnumerable<Card> aces = a_dealer.GetHand().Where(c => c.GetValue() == Card.Value.Ace); //get all aces from hand
IEnumerable<Card> handWithoutAces = a_dealer.GetHand().Where(c => c.GetValue() != Card.Value.Ace); //get all other cards from hand
int score = a_dealer.CalcCardsScore(handWithoutAces); //calc score of hand without aces
return aces.Count() > 0 && score == 6; //return if there is aces and score of other cards is 6
}
else
{
return a_dealer.CalcScore() < g_hitLimit;
}
}
示例13: Winner
public bool Winner(model.Player a_dealer, Player a_player)
{
if (a_dealer.CalcScore() > g_maxScore)
{
return false;
}
else if (a_player.CalcScore() > g_maxScore)
{
return true;
}
else
{
return a_player.CalcScore() < a_dealer.CalcScore();
}
}
示例14: DoHit
public bool DoHit(model.Player a_dealer)
{
int[] cardScore = a_dealer.getCardArrayValues();
int total = 0;
if (a_dealer.CalcScore() == g_hitLimit)
{
foreach (Card card in a_dealer.GetHand())
{
if (card.GetValue() != Card.Value.Ace)
{
total += cardScore[(int)card.GetValue()];
}
}
return total <= 6;
}
return a_dealer.CalcScore() < g_hitLimit;
}
示例15: DoHit
public bool DoHit(model.Player a_dealer)
{
IEnumerable<Card> cardList = a_dealer.GetHand();
if (a_dealer.CalcScore() < g_hitLimit)
{
return true;
}
if (a_dealer.CalcScore() == g_hitLimit)
{
foreach (Card card in cardList)
{
if (card.GetValue() == Card.Value.Ace)
{
return true;
}
}
}
return false;
}