Example #1
0
 public bool Hit(IPlayerHand playerHand, IBlackjackCard dealerFaceUpCard)
 {
     // Simplistic strategy
     return playerHand.Value() < 17 && playerHand.Bet is AnteBet;
 }
Example #2
0
        public double SettleBet(IPlayerHand hand, IDealerHand dealerHand)
        {
            if (hand.Busted)
                return hand.Bet.LoseAmount();

            if (dealerHand.Busted)
            {
                Balance += hand.Bet.Amount + hand.Bet.WinAmount();
                return hand.Bet.WinAmount()*-1;
            }

            // Neither hand busted

            if (hand.Value() == dealerHand.Value())
            {
                Balance += hand.Bet.Amount;
                hand.Bet = hand.Bet.ConvertToPushBet();

                return 0;
            }

            if (hand.Value() < dealerHand.Value())
            {
                return hand.Bet.LoseAmount();
            }

            Balance += hand.Bet.Amount + hand.Bet.WinAmount();
            return hand.Bet.WinAmount()*-1;
        }