A simple command-line blackjack game implemented in Python.
- Single-player gameplay against the dealer
- Visual card representation in the terminal
- Chip-based betting system (white $1, red $5, green $25, black $100, purple $500, orange $1000)
- Account balance tracking with transaction history
- Interactive gameplay with options to hit, stand, or double down
- Clone this repository:
git clone https://github.com/dynamic-stall/blackjack-python.git
cd blackjack-python
- Create and activate the conda environment from the provided file:
conda env create -f environment.yml
conda activate blackjack
- (Refer to my aws-iam-credential-report repo for Miniconda installation assistance, if Python is not present on your system.)
blackjack-python/
├── __init__.py
├── account.py # Account management for betting
├── card_components.py # Card, Deck, and Hand classes
├── constants.py # Game constants (cards, chips)
├── environment.yml # Conda environment configuration
├── game.py # Main game logic
├── main.py # Entry point
├── players.py # Player and Dealer classes
└── README.md # (This file)
- Run the game directly:
python3 main.py
-
Enter your name when prompted
-
Place bets using chip colors:
- Format: "[number] [color] [number] [color] ..."
- Example: "2 black 1 green" for $225 ($100 x 2 + $25)
-
Game Actions:
hit
: Draw another cardstand
: Keep current handdouble
: Double your bet and receive one more card (only available on initial hand)
-
Win Conditions:
- Get closer to 21 than the dealer without going over
- Dealer busts (goes over 21)
- Initial two cards totaling 21 (Blackjack)
This game uses pandas for transaction tracking. Make sure you have it installed via the environment.yml
file.
- Multiple player support
- Split pairs option
- Insurance bets
- Save game progress
- Statistics tracking