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.
- 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.
- Language: Python
- Game Library: Pygame
- Core Libraries:
copyrandom
Follow these instructions to get the game up and running on your local machine.
- Python 3.x
- Pygame library
-
Clone the repository:
git clone <repository_url> cd <repository_directory>
-
Install Pygame:
pip install pygame
-
Navigate to the project directory:
cd <repository_directory>
-
Run the game:
python orjbj.py
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.
blackjack-game/
├── orjbj.py # Main game file containing all the game logic and rendering
├── README.md # Documentation for the project
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with descriptive messages.
- Submit a pull request.
If you have any questions or suggestions, feel free to contact me at hsen8897@gmail.com.
Thank you for checking out this Blackjack game! I hope you enjoy playing it and find the code helpful.