Skip to main content

a python package for multiplayer blackjack gameplay

Project description

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()

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

blackjack_multi-0.1.6.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

blackjack_multi-0.1.6-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file blackjack_multi-0.1.6.tar.gz.

File metadata

  • Download URL: blackjack_multi-0.1.6.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

File hashes

Hashes for blackjack_multi-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ba99563328a4f0c39807501d1aff4741b4af553f561eaf0d91d171f20a667651
MD5 22a97f864a0c4de017e38c2f78f4230a
BLAKE2b-256 7f9ebe3e6eb55a6bc53d2666a2803773623753c3695a38761729ce448d1bb330

See more details on using hashes here.

File details

Details for the file blackjack_multi-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: blackjack_multi-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

File hashes

Hashes for blackjack_multi-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 54dbb079f58c73120452460740791d6ae89c2ed9736d68cf1b73b3d228cf2840
MD5 f851296a026586cac6f65f897aa762c7
BLAKE2b-256 0e131e2a8dbc730426e6061324a44c8084d068adb880f37ef6614f4ce30ece7b

See more details on using hashes here.

Supported by

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