A simple, modular command-line Blackjack game written in Python.
- Play classic Blackjack against the dealer
- Modular design:
Card,Deck,Hand, andGamecomponents - Dynamic point calculation for A (1 or 11)
- Highscore tracking with
highscores.json - Input validation, bet handling, and chip management
blackjack-cli/ ├── game.py # Main game loop and UI logic ├── card.py # Card class with suit/rank and display ├── deck.py # Deck class: shuffling and dealing ├── hand.py # Hand class: card management and score calc ├── utils.py # Utility functions (input, clear screen, etc.) ├── highscores.json # JSON file storing top scores ├── test_hand.py # Simple unit test for Hand class ├── .gitignore # Ignore pycache, venv, and temp files ├── README.md # This file - Each player starts with 1000 chips
- Bet before each round (min 1 chip)
- Blackjack (A + 10) pays 1.5x the bet
- Bust if hand value > 21
- Aces count as 11 or 1 based on total value
- Dealer draws until 17 or more
- Push (tie) if player and dealer have same score
git clone https://github.com/your-username/blackjack-cli.git cd blackjack-clipython game.pypython test_hand.pyMake sure test_hand.py is in the same directory as the game files, or adjust the import paths accordingly.
Requires Python 3.7+
MIT License. Feel free to fork and contribute!
Have fun beating the dealer!