Skip to contents

Determines whether a Blackjack hand qualifies as a "soft 17". A soft 17 is a total of 17 where an Ace is being counted as 11. This distinction affects the dealer's behavior — dealers typically hit on soft 17.

Usage

is_soft_17(hand)

Arguments

hand

A card vector representing a Blackjack hand (e.g. card(c("A", "6"), c("♠", "♣"))).

Value

A logical value: TRUE if the hand is a soft 17, FALSE otherwise.

Details

The function uses the blackjack_score() to calculate the hand’s value assuming optimal Ace handling, and then checks if lowering the Ace(s) to 1 would reduce the total below 17. If so, the hand is a soft 17.

Examples

is_soft_17(card(c("A", "6"), c("♠", "♣")))   # TRUE
#> [1] TRUE
is_soft_17(card(c("10", "7"), c("♠", "♦")))  # FALSE
#> [1] FALSE