Skip to main content

Blackjack Gameplay

This is a python package for playing multiplayer blackjack. The modules retain state to allow for splits, doubles, surrenders, stay, and hit. Multiple players can play, can a single player can have > 1 hand due to splits. Rules are flexible. By default, decks deplete until a stop card is hit. The module retains count, and manages rewards and possible actions.

Overview

This comes with 3 main modules to work with, but Game wraps the other 2 and generally abstracts away the need to work with them directly.

Example:

game = Game()

game.init_round([1, 1]) # 2 players, 1 unit each.
game.deal_init()

for i, player in enumerate(game.players):
    while not player.is_done():
        moves = player.get_valid_moves()
        # randomly take move, unless split is available.
        if "split" in moves:
            game.step_player(i, "split")
        else:
            move = choice(moves)
            game.step_player(i, move)

game.step_house(only_reveal_card=True)
while not game.house_done():
    game.step_house()

game.get_results()

Metadata

Release files for blackjack-multi 0.1.6

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

Source distribution (sdist)

Source distribution for blackjack-multi 0.1.6
File Size Uploaded
blackjack_multi-0.1.6.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for blackjack-multi 0.1.6
File Interpreter ABI Platform
blackjack_multi-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / blackjack_multi-0.1.6.tar.gz

Download URL blackjack_multi-0.1.6.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ba99563328a4f0c39807501d1aff4741b4af553f561eaf0d91d171f20a667651
BLAKE2b-256 checksum
How to use checksums
7f9ebe3e6eb55a6bc53d2666a2803773623753c3695a38761729ce448d1bb330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

Release files / blackjack_multi-0.1.6-py3-none-any.whl

Download URL blackjack_multi-0.1.6-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54dbb079f58c73120452460740791d6ae89c2ed9736d68cf1b73b3d228cf2840
BLAKE2b-256 checksum
How to use checksums
0e131e2a8dbc730426e6061324a44c8084d068adb880f37ef6614f4ce30ece7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

Release history Release notifications | RSS feed

This release

0.1.6 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