Skip to content

Sahdevagarwal/BlackJack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

🃏 Blackjack (Python - OOP)

Python Status License

A command-line Blackjack game built using Python with Object-Oriented Programming (OOP). This project simulates a real casino-style Blackjack experience including betting, dealer rules, and soft Ace handling.


🚀 Features

  • 🎮 Interactive CLI gameplay
  • 🧠 OOP design (Deck, Hand, Game)
  • 💰 Betting system with balance tracking
  • 🃏 Realistic Blackjack rules
  • ⚡ Instant Blackjack detection (natural 21)
  • 🔁 Replay system
  • 📊 Dynamic win/loss handling

🧠 Game Rules

  • Goal: Get as close to 21 as possible without exceeding it

  • Number cards = face value

  • Face cards (J, Q, K) = 10

  • Ace = 1 or 11 (auto-adjusted)

  • Dealer:

    • Hits below 17
    • Hits on soft 17
  • Bust (>21) → instant loss

  • Equal score → draw (push)

  • Blackjack (Ace + 10 in first 2 cards):

    • Pays 1.5× bet
    • Both Blackjack → draw

📁 Project Structure

blackjack/
│
├── main.py        # Main game file
└── README.md      # Project documentation

▶️ Getting Started

1. Clone the repository

git clone https://github.com/Sahdevagarwal/Blackjack.git
cd blackjack

2. Run the game

python main.py

💡 Example Gameplay

--- New Game ---
Your balance: 1000
Enter your bet: 100

Your hand: [10, 7], score: 17
Dealer's hand: 9

Hit or Stand? hit
Your hand: [10, 7, 2], score: 19

Hit or Stand? stand

Final Result:
Dealer's hand: [9, 8], score: 17
You win!

🧠 Concepts Used

  • Object-Oriented Programming (OOP)
  • Game state management
  • Conditional logic
  • Loops & control flow
  • Input validation

⚙️ Future Improvements

  • 🎨 GUI using pygame or tkinter
  • 🃏 Card visuals instead of numbers
  • 🔊 Sound effects
  • 📈 Game statistics
  • 🤖 AI-based suggestions
  • 🌐 Multiplayer

📌 Notes

  • Uses simplified deck (no suits)
  • Ace handled dynamically (11 → 1 when needed)
  • Deck resets every round

📜 License

This project is licensed under the MIT License.


🙌 Author

Developed by Sahdev Agarwal as a personal project to learn:

  • Python OOP
  • Game logic
  • Clean code practices

⭐ Show Your Support

If you like this project:

  • ⭐ Star the repo
  • 🍴 Fork it
  • 🚀 Build on it

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Contributors

Languages