A gambling package for Cards, Dice, and Blackjack
Project description
Gambling Python Package
####A project to create the necessary tools for gambling, such as cards and dice
Author | CJ Stein |
---|---|
Version | 1.0.0.dev2 |
Python Version | Only Tested on Python 3 |
Currently supports creation of:
- Dice
- Cards ##Installation pip install gambling ##Usage ###Dice
Input for Dice: Numbers shown are the default
- num=1 # This is the number of dice to use
- sides=6 # This is the number of sides on each dice
For 5 6-sided dice for something such as Yahtzee here would be the command:
from gambling import Dice
dice = Dice(num=5)
For one 20 sided dice for something like D&D:
from gambling import Dice
dice = Dice(sides=20)
For 3 20 sided dice:
from gambling import Dice
dice = Dice(num=3, sides=20)
Methods for Dice:
dice.roll() # This causes the list under the Dice.values to simulate a new roll.
dice.values # This will show the list of the values on the dice. The list is equal in length to the number of dice
# ouput example: [1, 2, 3, 4, 5]
###Cards
There are two objects in the Cards package:
- Card
- Deck
A Deck builds a list of Card objects. Cards rank and suits can be called, along with value if needed for arithmetic needs such as blackjack or war. The input needed for a card is a single letter rank as a string and a single letter suit.
Some things you can get from card:
from gambling import Card, Deck
AceOfSpades = Card('A','S')
TenOfHearts = Card('10','H')
TenOfHearts.rank # This will return 10
TenOfHearts.suit # This will return 'H'
AceOfSpades.rank # This will return 'A'
AceOfSpades.value # This will return 14, 'J' : 11, 'Q':12, 'K':13, 'A':14
Making cards by themselves isn't very useful, but making decks will be useful and you can use the Card object to get a value There is one optional input for Deck:
-
num = 1 # It defaults to using one deck, but you can change that to multiple decks if needed for something like blackjack
PokerDeck = Deck() PokerDeck.order # This returns a new deck with the cards in order PokerDeck.shuffle() # This shuffles the deck to randomize the order next(PokerDeck) # This calls the next card in the deck, the deck can be used as an iterator as such
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gambling-1.0.0.dev2.tar.gz
.
File metadata
- Download URL: gambling-1.0.0.dev2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd76f98d27cfa964a05399bd3a16a4dd08f044ac88f6556f9e6cd85a54d3824c |
|
MD5 | 8b3661224b4483b6bc4ca2c4667f330a |
|
BLAKE2b-256 | e7fa8d389bbce546e50b7bc9fbfa86a2a36d0ff6830d4b71c03544eb4e73eaf0 |
File details
Details for the file gambling-1.0.0.dev2-py3-none-any.whl
.
File metadata
- Download URL: gambling-1.0.0.dev2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6412ba42a3a317e44164907e7a0fbc79476df7c4767afdea1ed6765baca4d2f6 |
|
MD5 | c617a680412c3ae7726a7d8d704e0f75 |
|
BLAKE2b-256 | 85b053d141a30d70fa8ee933de72f9b7521ecbde6c1abc66db5de34dfb1e6f77 |