Skip to content
hhoppePublic

About

Blackjack Notebook (bjnb): Probabilistic analysis and simulation

Topics

Resources

Stars

11 stars

Watchers

2 watching

Forks

Repository files navigation

bjnb: Blackjack Notebook

Hugues Hoppe   —    [Open in Colab]   [in Kaggle]   [in MyBinder]   [in Deepnote]   [GitHub source]

Blackjack — "the most widely played casino banking game in the world".

Goals:

Versions:

  • 1.0 (March 2022): use probabilistic analysis for basic strategy tables and approximate house edge.
  • 2.0 (July 2022): add Monte Carlo simulation, hand analysis, and cut-card analysis.
  • 3.0 (January 2025): add CUDA implementation of simulation.
  • 3.1 (October 2026): fix bugs in simulating split hands and shoe ends; regenerate all results.

Running this Jupyter notebook:

  • The notebook requires Python 3.10 or later.
  • We recommend a Jupyter server on a local machine with a fast multi-core CPU and ideally an NVIDIA GPU.
    (The notebook can also be executed on a Colab server, where it greatly benefits from a CUDA GPU.)
  • Install JupyterLab on Linux or macOS, or on Windows within Windows Subsystem for Linux, because the multiprocessing uses fork.
  • Open the notebook (blackjack.ipynb file); its first cells install the required packages.
  • Evaluate all cells in Code library and then selectively evaluate Results.
  • Adjust the EFFORT global variable (or set the EFFORT environment variable) to trade off speed and accuracy.
  • Alternatively, after installing the packages listed in its first code cell, run the paired script directly, e.g., EFFORT=1 python blackjack.py.

References:

(See also references in Tables for basic strategy, Hand calculators, and House edge calculators.)

About

Blackjack Notebook (bjnb): Probabilistic analysis and simulation

Topics

Resources

Stars

11 stars

Watchers

2 watching

Forks

Used by

Contributors

Languages