Ejemplo n.º 1
0
  /**
   * returns the value of the player's split hand
   *
   * @param none
   * @return points the int points for the value of the split hand.
   * @since 1.0
   */
  public int getPointsSplit() {

    // the return counter.
    int playerHandValue = 0;

    // count points
    for (Card card : playerHandSplit) {
      playerHandValue += card.getCardRank().getCardPoints();
    }

    // handle aces
    for (Card card : playerHandSplit) {
      if (playerHandValue > 21 && card.getCardRank() == Rank.ACE) {
        playerHandValue -= 10;
      }
    }
    return playerHandValue;
  }
Ejemplo n.º 2
0
  /**
   * returns the value of the player's hand.
   *
   * @param none
   * @return points the int value of the hand.
   * @since 1.0
   */
  public int getPoints() {

    // the return counter
    int playerHandValue = 0;

    // count all points
    for (Card card : playerHand) {
      playerHandValue += card.getCardRank().getCardPoints();
    }

    // adjust for aces
    for (Card card : playerHand) {
      if (playerHandValue > 21 && card.getCardRank() == Rank.ACE) {
        playerHandValue -= 10;
      }
    }

    return playerHandValue;
  }