Calculates the total value of a Blackjack hand. Aces are worth 11 points by default,
but if the total exceeds 21, Aces are downgraded to 1 point as needed to avoid busting.
Arguments
- x
A character vector of card names (e.g., `"A♠"`, `"10♥"`, `"J♦"`), or a `card` object created by `create_shuffled_deck()`.
- ...
Additional arguments passed to methods. Not used.
Value
A single numeric value representing the total hand score.
Examples
card_value(c("10♠", "A♥")) # 21
#> [1] 21
card_value(c("A♠", "A♦", "9♣")) # 21 (11 + 1 + 9)
#> [1] 21
card_value(c("K♣", "7♦", "6♥")) # 23 (bust)
#> [1] 23
card_value(c("5♣", "3♦", "3♥")) # 11
#> [1] 11