Welcome to the Blackjack Flask Application! This project implements a classic game of Blackjack using Python's Flask framework. Below you will find information on how to set up, run, and contribute to the project.
The Blackjack Flask Application is a web-based implementation of the classic Blackjack game, built using Python's Flask framework. This project allows users to play Blackjack against a virtual dealer with features such as hit, stand, double down, and surrender.
- Classic Blackjack Gameplay: Experience traditional Blackjack with standard rules.
- Double Down and Surrender: Implemented game mechanics for doubling down and surrendering.
- Interactive Web Interface: User-friendly interface with real-time updates using JavaScript and Bootstrap.
- Game State Persistence: MongoDB integration for tracking user games and state persistence.
- API Endpoints: RESTful API for game actions and state management.
To get started with the Blackjack Flask application, follow these steps:
-
Clone the repository:
git clone https://github.com/thomasthaddeus/BlackjackFlask.git cd BlackjackFlask
-
Set up a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up MongoDB: Ensure MongoDB is installed and running. Update the MongoDB connection string in the configuration file.
-
Run the application:
flask run
After running the application, open your browser and navigate to http://127.0.0.1:5000
to start playing Blackjack.
- Allowed when the cards total 9, 10, or 11 without an ace, or when the cards total 16, 17, or 18 with an ace.
- Early Surrender: Available before the dealer checks for blackjack.
- Late Surrender: Available after the dealer checks for blackjack.
- When to Surrender:
- Surrender with a hard 16 against a dealer's 9, 10, or ace (except two 8s).
- Surrender with a hard 15 against a dealer's 10.
GET /api/start
: Starts a new gamePOST /api/hit
: Draws a cardPOST /api/stand
: Ends the player's turnPOST /api/double
: Doubles the bet and draws one final cardPOST /api/surrender
: Surrenders the hand
To set up and run the application locally, follow the detailed instructions provided in the Installation section of the documentation.
Comprehensive documentation is available, covering all aspects of the application, including setup, usage, game rules, and API endpoints. Visit the Documentation to learn more.
We welcome contributions from the community. Please see the Contributing section for guidelines on how to contribute to the project.
This project is licensed under the MIT License. See the LICENSE file for details.