Skip to main content

Card Playing Simulator focused on Blackjack

Project description

CardSharp: Advanced Card Game Simulation Framework

CardSharp is a powerful Python package for simulating, analyzing, and playing card games. While it currently focuses on Blackjack, its flexible architecture allows for easy extension to other card games.

GitHub stars License: MIT Python Versions

🚀 Key Features

  • 🃏 Robust Blackjack simulation with multiple strategies
  • 📊 Real-time visualization of game statistics
  • ⚙️ Highly configurable game rules and parameters
  • 🧪 Extensible framework for implementing new card games
  • 🖥️ Support for both CLI and programmatic usage
  • 🧮 Advanced statistical analysis of game outcomes

🛠️ Installation

# Clone the repository
git clone https://github.com/yourusername/cardsharp.git
cd cardsharp

# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`

# Install dependencies
pip install poetry
poetry install

🎮 Usage

CardSharp offers various modes of operation to suit different needs:

Blackjack Simulation

Run a batch simulation of Blackjack games:

python cardsharp/blackjack/blackjack.py --simulate --num_games 10000 --vis

This command simulates 10,000 games of Blackjack and displays a real-time visualization of the results.

Strategy Analysis

Compare different Blackjack strategies:

python cardsharp/blackjack/blackjack.py --analysis --num_games 5000

This runs a comparative analysis of Basic, Counting, Aggressive, and Martingale strategies over 5,000 games.

Interactive Console Mode

Play Blackjack interactively in the console:

python cardsharp/blackjack/blackjack.py --console

📁 Project Structure

  • cardsharp/
    • blackjack/: Blackjack-specific implementations
    • common/: Shared utilities and base classes
    • war/: War card game implementation
    • high_card/: High Card game implementation
    • roulette/: Roulette game implementation (in progress)

🧪 Testing

Run the test suite to ensure everything is working correctly:

pytest tests/

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests to ensure no regressions
  5. Commit your changes (git commit -am 'Add some amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Star Us!

If you find CardSharp useful, please consider giving it a star on GitHub. It helps us gain visibility and encourages further development!

GitHub stars

📬 Contact

For questions, suggestions, or discussions, please open an issue on GitHub or contact the maintainers directly.

Happy gaming and may the odds be ever in your favor! 🎰🃏

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cardsharp-0.5.0.tar.gz (88.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cardsharp-0.5.0-py3-none-any.whl (105.7 kB view details)

Uploaded Python 3

File details

Details for the file cardsharp-0.5.0.tar.gz.

File metadata

  • Download URL: cardsharp-0.5.0.tar.gz
  • Upload date:
  • Size: 88.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.3.0

File hashes

Hashes for cardsharp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9103801541fc8dc9c772d49bc42ad077e959e9f4898011fdbe1c6e1945a0271f
MD5 6d9267bcfccd338161dc395dcd7bc813
BLAKE2b-256 0a10582fc42c22b54ad55ab4443147444f53fd6c80c1c052f0643ae036aee864

See more details on using hashes here.

File details

Details for the file cardsharp-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: cardsharp-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 105.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.3.0

File hashes

Hashes for cardsharp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c7caa20bc76444a37b256546b041bfae4612133969419725f8d4f89cdf25883
MD5 6e57f135d8bc54e3e5544e4aa3124439
BLAKE2b-256 36d76e005bccbf0eaa875403ee8f39ee3aac84410b4ab8f0748f18e32ccbe5ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page