Skip to content

pengchong1113/blackjack_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blackjack Demo

A Blackjack web application built with Streamlit, powered by the blackjack-engine package.

About

This project demonstrates the usage of the blackjack-engine package — a custom-built Python library that implements the core logic of the Blackjack card game, including deck management, hand evaluation, and game state handling.

The frontend is built with Streamlit, providing an interactive browser-based UI where players can place bets, hit, stand, and play through full rounds of Blackjack.

Project Structure

blackjack_demo/
├── .gitignore      # Git ignore rules
├── .python-version # Python version pin for tooling
├── README.md       # Project documentation
├── main.py         # Streamlit UI — page layout, styling, and game interaction
├── pyproject.toml  # Project metadata and dependencies managed by uv
└── uv.lock         # Locked dependency versions generated by uv

main.py is responsible for all frontend presentation:

  • Loads a background image and applies custom CSS styling
  • Renders the header with player balance and a "New Game" button
  • Handles bet input (including an All In option)
  • Displays dealer and player cards during a round
  • Supports Hit, Stand, Double Down, and Split actions
  • Shows round results and allows continuing to the next round

All underlying game logic (deck, hand evaluation, game state) is handled by the blackjack-engine package.

Features

  • Interactive Blackjack gameplay in the browser
  • Bet management with a starting balance
  • Hit, Stand, Double Down, and Split support
  • Powered by the blackjack-engine package for all game logic

Getting Started

Prerequisites

  • uv package manager

Setup

1. Create a new project

uv init blackjack_demo
cd blackjack_demo

2. Create and activate a virtual environment

uv venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate

3. Install dependencies

uv add --default-index https://test.pypi.org/simple/ --index https://pypi.org/simple blackjack-engine
uv add streamlit

Run

uv run streamlit run main.py

The browser will open automatically at http://localhost:8501.

Package

The core game logic is provided by the blackjack-engine package, published on TestPyPI:
https://test.pypi.org/project/blackjack-engine/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages