Welcome to the Black Jack project in Python! This project is a simple implementation of the popular card game Black Jack, developed entirely in Python.
This project simulates a game of Black Jack where the player competes against the dealer. The goal of the game is to get a hand with a value as close to 21 as possible without exceeding it, and to surpass the dealer's hand value.
- Single-player game against the dealer.
- Basic Black Jack rules.
- Interactive text-based interface.
- Clean and modular code for easy understanding and extension.
- Python 3.x
-
Clone this repository to your local machine.
git clone https://github.com/JorgeAJT/black-jack.git
-
Navigate to the project directory
cd blackjack-python
-
(Optional) Create and activate a virtual environment.
python3 -m venv env source env/bin/activate # On Windows use `env\Scripts\activate`
-
Install the necessary dependencies (if any).
pip install -r requirements.txt
-
To start the game, simply run the main.py script:
python main.py
-
Initial Deal: Two cards are dealt to the player and two to the dealer. One of the dealer's cards remains hidden until the end of the game.
-
Player's Turn: The player can choose to "Hit" (receive an additional card) or "Stand" (keep their current hand), in case it is not a straight blackjack, in that case the player win directly.
-
Dealer's Turn: After the player stands, the dealer reveals their hidden card and decides to "Hit" or "Stand" based on fixed rules (typically, the dealer hits on 16 or less and stands on 17 or more).
-
Determining the Winner:
- If the player exceeds 21, they lose.
- If the dealer exceeds 21, the player wins.
- If neither exceeds 21, the hand with the lower value wins.
- In the event of a tie, the number of cards is counted and the player with the fewest cards wins. In case of an equal number of cards, the match is considered a draw.
Contributions are welcome. Please follow these steps:
-
Fork the project.
-
Create a new branch with your changes:
git checkout -b my-branch
-
Make your changes and commit them:
git commit -m "Description of my changes"
-
Push your changes to your forked repository:
git push origin my-branch
-
Create a Pull Request on GitHub.
Jorge Jiménez - JorgeAJT