Exemplo n.º 1
0
        private void _stand_Click(object sender, EventArgs e)
        {
            if (DealerTotalCardValue < 17 && ValidBet)
            {
                DealerTotalCardValue = 0;
                while (Rules.GiveDealerCard(DealerTotalCardValue))
                {
                    dealer.GetCardToDealer();
                    DealerTotalCardValue = StaticMethods.CountValue(dealer.ShowDealerHand());
                }
                Update();

                if (!Rules.NotOver21(DealerTotalCardValue))
                {
                    player.balance += bet;
                    player.balance += bet;
                    Win();
                }
                else if (StaticMethods.CountValue(player.PlayerHand) > StaticMethods.CountValue(dealer.DealerHand))
                {
                    player.balance += bet;
                    player.balance += bet;
                    Win();
                }
                else
                {
                    Loose();
                }
            }
            Update();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Player stands and let dealer get cards
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _stand_Click(object sender, EventArgs e)
 {
     if (DealerCardValue < 17 && validBet)
     {
         DealerCardValue = 0;
         while (Rules.GiveDealerCard(DealerCardValue))
         {
             dealer.GetCardToDealer();
             DealerCardValue = StaticMethods.CountValue(dealer.ShowDealerHand());
         }
         Update();
         if (!Rules.NotOver21(DealerCardValue))
         {
             Win();
         }
         else if (PlayerWinValue == 21 && DealerWinValue == 21)
         {
             Draw();
         }
         else if (PlayerWinValue > DealerWinValue)
         {
             Win();
         }
         else
         {
             Loose();
         }
     }
     Update();
 }
Exemplo n.º 3
0
 public void GiveCards(Player player, Dealer dealer)
 {
     player.PlayerHand.Clear();
     dealer.DealerHand.Clear();
     dealer.GetCardToDealer();
     player.GetCard(dealer.GiveCard());
     player.GetCard(dealer.GiveCard());
 }