Skip to content

halilsen47/BlackJackGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

🃏 Blackjack Game in Pygame

This project is a classic Blackjack game implemented using the Pygame library. It provides a graphical interface for playing Blackjack against a dealer, complete with card dealing, score calculation, and win/loss tracking. The game allows players to "Hit" or "Stand," and the dealer follows standard Blackjack rules.

🚀 Key Features

  • Interactive Gameplay: Provides a user-friendly interface for playing Blackjack.
  • Card Dealing: Deals cards randomly from a shuffled deck to both the player and the dealer.
  • Hand Value Calculation: Accurately calculates the value of each hand, including handling the Ace (A) as either 1 or 11.
  • Player Actions: Allows the player to choose to "Hit" (take another card) or "Stand" (end their turn).
  • Dealer Logic: Implements the dealer's AI, which hits until their hand value is 17 or higher.
  • Win/Loss Determination: Determines the winner based on standard Blackjack rules (reaching 21, busting, or having a higher hand value than the dealer).
  • Score Tracking: Keeps track of the number of wins, losses, and draws.
  • Graphical Rendering: Uses Pygame to draw cards, scores, buttons, and messages on the screen.
  • Event Handling: Responds to user input (mouse clicks) to control the game.

🛠️ Tech Stack

  • Language: Python
  • Game Library: Pygame
  • Core Libraries:
    • copy
    • random

📦 Getting Started

Follow these instructions to get the game up and running on your local machine.

Prerequisites

  • Python 3.x
  • Pygame library

Installation

  1. Clone the repository:

    git clone <repository_url>
    cd <repository_directory>
  2. Install Pygame:

    pip install pygame

Running Locally

  1. Navigate to the project directory:

    cd <repository_directory>
  2. Run the game:

    python orjbj.py

💻 Usage

Once the game is running, you'll see the main menu with "DEAL" and "QUIT" options.

  • Click "DEAL" to start a new game.
  • During the game, click "HIT" to take another card or "STAND" to end your turn.
  • The game will automatically determine the winner and update the score.
  • Click "QUIT" from the main menu to exit the game.

📂 Project Structure

blackjack-game/
├── orjbj.py          # Main game file containing all the game logic and rendering
├── README.md         # Documentation for the project

🤝 Contributing

Contributions are welcome! If you'd like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with descriptive messages.
  4. Submit a pull request.

📬 Contact

If you have any questions or suggestions, feel free to contact me at hsen8897@gmail.com.

💖 Thanks Message

Thank you for checking out this Blackjack game! I hope you enjoy playing it and find the code helpful.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages