コード例 #1
0
 private void btnDouble_Click(object sender, EventArgs e)
 {
     if (Hit < 4)
     {
         if (Bet > 0)
         {
             if (PlayerMoney - Bet >= 0)
             {
                 PlayerMoney        -= Bet;
                 Bet                *= 2;
                 lblBetAmount.Text   = Bet.ToString();
                 lblPlayerMoney.Text = PlayerMoney.ToString();
                 Hand();
                 changeTurn();
             }
         }
         else
         {
             MessageBox.Show("You first need to bet");
         }
     }
     else
     {
         MessageBox.Show("Your already had Hits");
     }
 }
コード例 #2
0
 public void setBetAmount(int amount)
 {
     if (PlayerMoney - amount >= 0)
     {
         Bet          = Bet + amount;
         PlayerMoney -= amount;
     }
     lblBetAmount.Text   = Bet.ToString();
     lblPlayerMoney.Text = PlayerMoney.ToString();
 }
コード例 #3
0
        public void initializeGame(int Hit)
        {
            PlayerHand   = new List <Card>();
            PlayerLabels = new List <Label>();
            PcHand       = new List <Card>();
            PcLabels     = new List <Label>();

            if (Hit != 1)
            {
                //eliminare le carte estratte dal tavolo
            }

            Position    = 0;
            PlayerScore = 0;
            PcScore     = 0;
            Turn        = 0;
            Bet         = 0;
            Hit         = 1;
            deck.shuffle(2 * numCards);
            //inizio partita
            lblPcTurn.Hide();

            /*Hand(Turn);
            *  Hand(Turn);
            *
            *  Turn = 1;
            *  Hand(Turn);*/

            lblPcPoint.Text      = PcScore.ToString();
            lblPlayerPoints.Text = PlayerScore.ToString();
            lblPlayerMoney.Text  = PlayerMoney.ToString();
            lblBetAmount.Text    = Bet.ToString();

            /*if (PlayerScore == 21)
             * {
             *  System.Threading.Thread.Sleep(500);
             *  Hand(Turn);
             *  if (PcScore != 21)
             *  {
             *      MessageBox.Show("BLACKJACK! You win.");
             *      PlayerMoney += (int)(Bet * winBlack);
             *  }
             *  else if (PcScore == 21)
             *      {
             *          MessageBox.Show("PUSH! Nothing done.");
             *          PlayerMoney += Bet;
             *      }
             * }*/

            //Turn = 0;
        }