This is a simple implementation of the Blackjack card game in Python. The player plays against the computer's dealer and tries to get a hand value as close to 21 as possible without exceeding it.
- Python 3.x
-
Clone the repository or download the
blackjack.py
file. -
Open a terminal or command prompt.
-
Navigate to the directory where the
blackjack.py
file is located. -
Run the following command:
python blackjack.py
- At the beginning of the game, the player is given $100,000 in virtual money.
- The player places a bet from their available money.
- The player and the dealer are each dealt two cards.
- The player's cards are displayed along with their sum.
- The dealer's first card is shown, and the sum is hidden.
- The player decides whether to add another card or not.
- If the player's hand value exceeds 21, they lose the bet.
- If the player chooses to stop or their hand value is 21, the dealer reveals their cards.
- The dealer keeps drawing cards until their hand value reaches 16 or higher.
- If the dealer's hand value exceeds 21 or is lower than the player's hand value, the player wins the bet.
- If the player's and dealer's hand values are the same, it's a push (tie).
- If the dealer's hand value is higher than the player's, the player loses the bet.
- The player's money is updated based on the outcome of the game.
- The game continues until the player decides to quit or runs out of money.
The game can be customized and expanded with the following features:
- Implementing a betting system with different bet amounts.
- Allowing multiple players to participate.
- Adding graphical user interface (GUI) elements for a more interactive experience.
Have fun playing! 🎉🎲