Exemple #1
0
 /// <summary>
 /// Eventhandler for New Card button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     buttonHold.Enabled = true;
     x(sender, e);
     if (h.showHand().BJscore() >= 21)
     {
        button1.Enabled = false;
        //buttonHold.Enabled = false;
     }  
 }
Exemple #2
0
 /// <summary>
 /// Method that will handle the operation for click event, which adds card.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 internal void handle(object sender, EventArgs e)
 {
     if (guestPlayer.showHand().BJscore() == 21)
     {
         flag = false;
         guestPlayer.outcomeOfRound(Outcome.NotWin);
         housePlayer.outcomeOfRound(Outcome.Win);
         housePlayer.showHand();
         MessageBox.Show("BlackJacK! You Win!");
     }
     if (housePlayer.showHand().BJscore() == 21)
     {
         win++;
         flag = false;
         guestPlayer.outcomeOfRound(Outcome.Win);
         housePlayer.outcomeOfRound(Outcome.NotWin);
         MessageBox.Show("BlackJack!!! You  Win!!");
         housePlayer.showHand();
     }
     guestPlayer.getsCard(d.deal());
     foreach (Observer y in obseveres)
     {
         y();
     }
 }
 static void testHuman()
 {
     BlackJack3.Deck d = new BlackJack3.Deck();
     Human hm = new Human("Human");
     Console.WriteLine("Testing Human.cs.....\n");
     hm.getsCard(d.deal());
     Console.WriteLine("Human's card is: " + hm.showHand().ToString());
 }
Exemple #4
0
 /// <summary>
 /// Method that will show the BlackJack score for Human player in form
 /// </summary>
 public void showScore()
 {
     label1.Text = "Score = " + h.showHand().BJscore() + "\nRound: " + h.checkRound() + "\nWins: " + h.checkWin();
     Refresh();
 }