Skip to contents

Dealer draws cards until reaching at least 17, or hitting 5 cards without busting.

Usage

dealer_play(dealer_hand, deck)

Arguments

dealer_hand

Character vector of the dealer's current hand

deck

Character vector of the remaining deck

Value

A list with updated dealer_hand and deck

Examples

# Basic example
set.seed(123)
deck <- create_board(1)
dealer_hand <- c("A♠", "6♦")
result <- dealer_play(dealer_hand, deck)
print(result$dealer_hand)  # Should show hand with score >= 17
#> [1] "A♠" "6♦" "8♦" "4♦"

# Dealer hits on soft 17: A♠ + 6♠
deck <- c("5♣", "2♦", "3♥", "K♠", "8♠", "9♣")  # sample deck
dealer_hand <- c("A♠", "6♠")
dealer_play(dealer_hand, deck)
#> $dealer_hand
#> [1] "A♠" "6♠" "5♣" "2♦" "3♥"
#> 
#> $deck
#> [1] "K♠" "8♠" "9♣"
#>