Design a Blackjack Game

Medium
GamesStrategyObserverFactory

Problem Statement

Design a Blackjack card game system that supports:

  • Multiple players at a table
  • Standard Blackjack rules (hit, stand, double down, split)
  • Dealer AI following house rules (must hit on 16 or less)
  • Betting system
  • Deck management with shuffling

Design Requirements

Key Entities:

  • Card — Suit + Rank, knows its Blackjack value
  • Deck / Shoe — One or multiple decks, shuffled
  • Hand — A player's current cards, calculates total with Ace handling
  • Player — Human player with chips/bet
  • Dealer — Follows house rules automatically
  • BlackjackGame — Game controller

Key Behaviors:

  • dealInitialCards() — 2 cards to each player and dealer
  • hit(player) — Deal one more card to player
  • stand(player) — Player ends their turn
  • evaluateWinners() — Compare all hands to dealer, distribute chips

!Constraints

- Use 6 decks shuffled together (standard casino) - Ace is 11 unless it causes bust, then 1 - Dealer stands on 17+, hits on 16 or less - Blackjack (Ace + 10-value on deal) pays 3:2 - Bust (> 21) is an automatic loss - Support 1–7 players at a table
Output

Run your code to see output here.