a collection of gambling classes/tools
Project description
gamble is a simple library that implements a collection of some common gambling-related classes
Features
die, dice
cards, decks
Usage
Installation
pip install gamble
Basic Usage
Dice
import gamble
# create dice, defaults to 2 6-sided dice
dice = gamble.Dice()
# roll
dice.roll()
>>> 6
dice.rolls
>>> 1
# max, min
dice.max
>>> 12
dice.min
>>> 2
# d-notation for dice constructor
dice = gamble.Dice('d20+8')
# max, min
dice.max
>>> 28
dice.min
>>> 9
# parts
dice.parts
>>> [<d20 Die>, 8]
Cards
import gamble
# create a deck, defaults to the standard 52 card deck, no jokers
# the deck will be shuffled by default, unless you pass shuffle=False
deck = gamble.Deck()
deck.cards_left
>>> 52
deck.top
>>> <Card:7♠>
deck.bottom
>>> <Card:9♠>
deck.shuffle() # you can also pass times=(int) to shuffle more than once
card = deck.draw() # you can also pass times=(int) to draw a list of cards
>>> <Card:A♠>
# the unicode cards icons are implemented as well!
card.unicode
>>> "🂡"
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
gamble-0.0.5.tar.gz
(5.9 kB
view hashes)