public void DealCard(Hand hand, bool faceup) { var card = cardDeck.Draw(); // Draw a card from the deck card.FaceUp = faceup; // Face it up or down if (hand == DealerHand && DealerHand.HandTotal() >= 17) { return; } hand.Cards.Add(card); // Give it the player's hand }
public string Stand() { int userTotal = UserHand.HandTotal(); int dealerTotal = DealerHand.HandTotal(); if (userTotal <= 21) { if (Math.Abs(21 - userTotal) < Math.Abs(21 - dealerTotal)) { return("user"); } } if (userTotal <= 21 && userTotal == dealerTotal) { return("draw"); } return("dealer"); }