Skip to main content

BlackjackSim

Source code: GitHub

BlackjackSim is a Python implementation of the Blackjack card game. It allows interactive play with one player and a computer dealer. It also includes a simulation mode where both the dealer and the player are played by the computer. Simulation mode can be used to analyze different player strategies over many hands, and to generate game-play statistics. In simulation mode, the player uses a play strategy described by Hoyle's Rules of Games.

Credit where credit is due

  • The Strategy design pattern is used to implement playing strategies, and follows the concepts, UML diagrams, and examples provided in "Design Patterns: Elements of Reusable Object-Oriented Software," by Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides, published by Addison-Wesley, 1995.
  • The HoylePlayerPlayStrategy class implements the player strategy as described in "Hoyle's Rules of Games," by A.H. Morehead and G. Mott-Smith, second revised edition, published by Signet, 1983.

Requirements

Usage

To play the game interactively or to run various simulations:

python -m BlackjackSim.main

A menu of options for play and simulation will be presented.

Unittests

Unit tests for BlackJackSim have filenames starting with test_. To run the unit tests, type python -m unittest discover -s .\..\tests -v in a terminal window in the project directory.

License

MIT License. See the LICENSE file for details

Metadata

Release files for BlackjackSim 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BlackjackSim 1.0.0
File Size Uploaded
blackjacksim-1.0.0.tar.gz 36.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for BlackjackSim 1.0.0
File Interpreter ABI Platform
blackjacksim-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 60.4 kB

Release files / blackjacksim-1.0.0.tar.gz

Download URL blackjacksim-1.0.0.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
63926cccaf0b15a5d4f773779056570a76d494eb5953b7417b658b2c3a47ce80
BLAKE2b-256 checksum
How to use checksums
6f20fb27c88bb710ae998cca825fa2282ff8dad1c3b5dd46803a0a6be6fb7ee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 17, 2025.

Transparency log

Release files / blackjacksim-1.0.0-py3-none-any.whl

Download URL blackjacksim-1.0.0-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
485dec33bb8a39da6eeccdb26ee5286388168853689691b815de49f8ce9c5573
BLAKE2b-256 checksum
How to use checksums
01d0438c4452a9d6790ced6b20841cc6f9b63929599b6e9d39ef53a4c5ed82b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page