GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mmichie/cardsharp: CardSharp is a Python package for simulating and testing card games. The package currently supports Blackjack but can be extended to support more card games.

BranchesTags
Open more actions menu

Latest commit

 

History

579 Commits
579 Commits

Folders and files

NameName
Last commit message
Last commit date
.beads
.beads
 
 
.github
.github
 
 
.vscode
.vscode
 
 
cardsharp
cardsharp
 
 
crates/cardsharp-core
crates/cardsharp-core
 
 
docs
docs
 
 
examples
examples
 
 
tests
tests
 
 
web
web
 
 
.flake8
.flake8
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.python-version
.python-version
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
RELEASING.md
RELEASING.md
 
 
lefthook.yml
lefthook.yml
 
 
pylintrc
pylintrc
 
 
pyproject.toml
pyproject.toml
 
 
pyrefly.toml
pyrefly.toml
 
 
pytest.ini
pytest.ini
 
 
shell.nix
shell.nix
 
 
uv.lock
uv.lock
 
 

Repository files navigation

CardSharp

A Python framework for simulating and analyzing card games. Currently supports Blackjack, War, High Card, Baccarat, Dragon Tiger, and Durak.

License: MIT

Installation

git clone https://github.com/mmichie/cardsharp.git
cd cardsharp
uv sync

Usage

Simulation

# Run 10,000 blackjack games with visualization
uv run python cardsharp/blackjack/blackjack.py --simulate --num_games 10000 --vis

# Compare strategies (Basic, Counting, Aggressive, Martingale)
uv run python cardsharp/blackjack/blackjack.py --analysis --num_games 5000

# Performance profiling
uv run python cardsharp/blackjack/blackjack.py --simulate --profile --num_games 1000

Interactive Play

# Console blackjack
uv run python cardsharp/blackjack/blackjack.py --console

# Full CLI game with options
uv run python examples/cli_blackjack.py --players 3 --bankroll 500 --rounds 5

Examples

uv run python examples/async_api_demo.py        # Async API with event-driven flow
uv run python examples/blackjack_engine_demo.py  # Engine with immutable state
uv run python examples/adapter_demo.py           # Platform adapter system
uv run python examples/modern_blackjack_ui.py    # Streamlit web UI

See examples/ for the full set of demos.

Architecture

CardSharp uses an event-driven architecture with immutable state transitions:

  • Events -- Components communicate through pub/sub (cardsharp/events/)
  • Immutable State -- Game state transitions via pure functions (cardsharp/state/)
  • Engines -- Game logic per game type (cardsharp/engine/, cardsharp/blackjack/, etc.)
  • Adapters -- Platform-specific rendering and input (cardsharp/adapters/)
  • APIs -- High-level sync/async interfaces (cardsharp/api/)

Testing

uv run pytest                              # Run all tests
uv run pytest --cov=cardsharp              # With coverage
uv run pytest tests/api/test_event_cleanup.py -v  # Specific module
uv run pytest -n auto                      # Parallel

License

MIT

About

CardSharp is a Python package for simulating and testing card games. The package currently supports Blackjack but can be extended to support more card games.

Topics

blackjackblackjack-cliblackjack-pythonblackjack-simulatorblackjack-strategycard-gamecardsgamblingpythonsimulation

Resources

Readme
MIT license
Activity

Stars

10 stars

Watchers

2 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.