Skip to main content

A python package for playing blackjack, with the option to get 'drunk' and see how it affects your play!

Project description

CI / CD

Drunk Blackjack

Overview

A lighthearted blackjack python package that gives you the option to get "drunk" and see how it affects your play, as well as get commentary on your actions and get good or bad advice on gambling. Warning: don't drink like this in real life!

PyPI Link

Drunk Blackjack

How to Play Blackjack

The goal of blackjack is to beat the dealer by getting a card total as close to 21 as possible without going over. You can "hit" to get another card or "stand" to keep your current cards as is. Whoever is closest to 21 wins, but if you get over 21, you bust and lose.

Usage

Import the package

from drunkblackjack import module

Functions

Function 1: Start the game

start_game(bet_amount)

Start a game of blackjack, which will be played on the command line. Takes an amount to bet as an argument.

Example:

module.start_game(100)

Function 2: Take shots

take_shots(number_of_shots)

Take some shots, specifying the number as an argument. The more shots you take, the drunker you get, and if you get too drunk, your blackjack gameplay will be affected. Returns a message about how drunk you are.

Example:

print(module.take_shots(5))

Function 3: Get advice

get_advice(advice_type)

Get advice on gambling. Takes 'good' or 'bad' as an argument, for good or bad advice respectively.

Example:

print(module.get_advice('bad'))

Function 4: Get commentary

get_commentary(action)

Get commentary on various blackjack actions ('hit', 'stand', or 'bust'). Changes depending on how drunk you are.

Example:

print(module.get_commentary('hit'))

See the example program for more.

Contribution Instructions

  1. Clone the repo
git clone https://github.com/software-students-fall2024/3-python-package-swe-switching-with-econ.git
  1. Install and activate pipenv
pip install pipenv
pipenv shell
  1. Build the project
python -m build
  1. Test with pytest
pytest

Installing and Running the Package

  1. Install and activate pipenv
pip install pipenv
pipenv shell
  1. Install the package using pip
pip install drunkblackjack==1.0.3
  1. Create a Python program file that imports and uses the package according to the usage instructions above, or use our example program example_program.py
  2. Run the program:
python3 example_program.py

Or

python example_program.py

Team

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

drunkblackjack-1.0.3.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

drunkblackjack-1.0.3-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file drunkblackjack-1.0.3.tar.gz.

File metadata

  • Download URL: drunkblackjack-1.0.3.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for drunkblackjack-1.0.3.tar.gz
Algorithm Hash digest
SHA256 9cc6d3eaed20d1c9917386a750b321a193f4c606332ab9d289bf1181c3e1cf95
MD5 3077e80e33f2661cdd169c3f619174f4
BLAKE2b-256 41b4be13b40a619a2b01f59578390fb9c2380f018e666db74a7c0f4f337ac269

See more details on using hashes here.

File details

Details for the file drunkblackjack-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: drunkblackjack-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for drunkblackjack-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c0062ce123c0e3a8291d8a87cd65f34080bd5e9ad3ee28a67d1cefbd8c74a50b
MD5 b852d55f34fccb22ff366c597bc470a6
BLAKE2b-256 998795763540047ed3f5d6a879859a75a546277de0efb51366fd167193e5a679

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