private int GetValueSum(IList <Card> cards) { // first sum up first values int sum = cards.Sum(c => CardLogic.GetValues(c)[0]); if (sum <= WinningValue) { return(sum); } // if we are to high, we try other values, if any sum = cards.Sum(c => { int[] values = CardLogic.GetValues(c); if (values.Length > 1) { return(values[1]); } else { return(values[0]); } }); return(sum); }
private bool IsBlackJack(IList <Card> cards) { if (cards.Count == 2) { if (CardLogic.IsJackQueenOrKing(cards[0]) && cards[1] == Card.Ace) { return(true); } else if (CardLogic.IsJackQueenOrKing(cards[1]) && cards[0] == Card.Ace) { return(true); } } return(false); }