Simulate a Multiplayer Blackjack Game
simulate_blackjack_game.Rd
This function simulates a complete round of Blackjack between one or more players and a dealer. Each player is dealt two cards and follows a simple decision strategy (e.g., hit on low scores). The dealer plays according to standard rules, including hitting on soft 17.
Value
A structured list of class "blackjack_game"
containing:
- players
A list of player results. Each contains the player's hand, final score, and outcome message.
- dealer
A list with the dealer's final hand and score.
Details
Each player acts independently and uses a basic AI decision rule: hit below 12, stand at 17+, and probabilistic decisions between 12–16. The dealer continues hitting until reaching 17 or more, and hits on a soft 17.
Examples
simulate_blackjack_game(num_players = 2, seed = 123)
#> Dealer's hand: 6♦ 3♥ A♥
#> Dealer's score: 20
#>
#> Player 1 hand: 2♥ 4♠ Q♦ Q♣
#> Player 1 score: 26
#> Player 1 result: Player busts! Dealer wins.
#>
#> Player 2 hand: 4♣ 5♣ K♥
#> Player 2 score: 19
#> Player 2 result: Dealer wins!
#>