A simple version of the card game Blackjack with python using OOP
The objective of the game is to beat the dealer by having a hand value of 21 or as close to 21 as possible, without going over.
Here's how the game is played:
- Each player is dealt two cards, face up. The dealer is also dealt two cards, but only one is face up while the other is face down.
- The players look at their cards and decide whether they want to "hit" (take another card) or "stand" (keep the current hand). Players take turns hitting or standing until they either have a hand value of 21 or they have gone over 21 and "busted".
- Once all players have completed their turn, the dealer reveals their second card. The dealer must hit until their hand value is at least 17, and then they must stand.
- If the dealer busts (goes over 21), then all remaining players win. If the dealer does not bust, then the player's hands are compared to the dealer's hand, and the player with the highest hand value that is less than or equal to 21 wins.
- If a player has a hand value of 21 with their first two cards (an Ace and a 10-point card, such as a 10, Jack, Queen, or King), this is called a "blackjack" and the player automatically wins, unless the dealer also has a blackjack, in which case it is a tie.