public bool DoubleDown(Hand hand) { // This method determines whether a double-down is possible and, // if so, doubling the bet. int handTotal = hand.Total(); if (((handTotal >= 7 && handTotal <= 11) || hand.IsSoft) && hand.Count == 2) { // Reduce the bank bank -= hand.Wager; // Double the bet hand.Wager *= 2; // Mark the hand as doubled so the last card is drawn at an angle hand.Doubled = true; // Tell the form that we doubled. The form then moves on to the next player. return true; } return false; }
public OutcomeType Outcome( Hand dealerHand, int numberOfHands ) { OutcomeType returnValue = OutcomeType.None; bool dealerBlackjack = dealerHand.Total() == 21 && dealerHand.Count == 2; if( this.Total() > 0 ) { if( Total() > 21 ) returnValue = OutcomeType.Lost; else if( IsBlackjack() && !dealerBlackjack && numberOfHands == 1 ) returnValue = OutcomeType.Blackjack; else if( dealerHand.Total() > 21 ) returnValue = OutcomeType.Won; else if( Total() < dealerHand.Total() ) returnValue = OutcomeType.Lost; else if( Total() > dealerHand.Total() ) returnValue = OutcomeType.Won; else if( Total() == dealerHand.Total() ) returnValue = OutcomeType.Push; } return returnValue; }