Exemplo n.º 1
0
  public boolean NewGame(Deck a_deck, Dealer a_dealer, Player a_player) {
    Card c;

    c = a_deck.GetCard();
    c.Show(true);
    a_player.DealCard(c);

    c = a_deck.GetCard();
    c.Show(true);
    a_dealer.DealCard(c);

    c = a_deck.GetCard();
    c.Show(true);
    a_player.DealCard(c);

    c = a_deck.GetCard();
    c.Show(false);
    a_dealer.DealCard(c);

    return true;
  }
 public boolean doHit(Player a_dealer) {
   if (a_dealer.calcScore() == g_hitLimit) {
     boolean hasAce = false;
     int scoreRest = 0;
     for (Card c : a_dealer.getHand()) {
       if (c.GetValue() == Card.Value.Ace) {
         if (!hasAce) {
           hasAce = true;
           continue;
         } else {
           scoreRest += 1;
         }
       } else {
         scoreRest += a_dealer.valueCard(c);
       }
     }
     if (hasAce) {
       return scoreRest < g_hitLimit - 10;
     }
   }
   return a_dealer.calcScore() < g_hitLimit;
 }