Abstract games stuff
Project description
Abstract games stuff
Install
pip install AGStuff
Requirements
- python>=3.6
Usage
Cards
>>> from agstuff.cards.core import Card, Cards, Deck
>>>
>>> card1 = Card('As')
>>> card1
A♠
>>> card2 = Card('8d')
>>> card2
8♦
>>> card1 > card2
True
>>>
>>> cards = Cards('As/Ks/Qs')
>>> cards
[A♠, K♠, Q♠]
>>> card1 in cards
True
>>>
>>> cards = Cards(cards=(card2, Card('Tc'), Card('4h')))
>>> cards
[8♦, 4♥, T♣]
>>> card2 in cards
True
>>>
>>> deck = Deck()
>>> cards = Cards()
>>> cards.pull(deck, 5)
>>> cards
[9♥, 2♦, 8♣, 6♠, K♥]
Dices
>>> from agstuff.dices.core import Dice, DiceBox
>>>
>>> dice1 = Dice(faces_count=6)
>>> dice1
1 of [1, 2, 3, 4, 5, 6]
>>> dice2 = Dice(6)
>>> dice2
6 of [1, 2, 3, 4, 5, 6]
>>> dice1.rolling()
5
>>> dice1
5 of [1, 2, 3, 4, 5, 6]
>>> dice2.rolling()
1
>>> dice2
1 of [1, 2, 3, 4, 5, 6]
>>> dice1 + dice2
6
>>> dice1 > dice2
True
>>>
>>> dice3 = Dice(faces_items=('Q', 'W', 'E', 'R', 'T', 'Y'))
>>> dice3
E of ['Q', 'W', 'E', 'R', 'T', 'Y']
>>> dice3.rolling()
'Y'
>>> dice3
Y of ['Q', 'W', 'E', 'R', 'T', 'Y']
>>>
>>> dice_box = DiceBox()
>>> dice_box.add(dice1)
>>> dice_box.add(dice2)
>>> dice_box.rolling()
8
>>> dice1
5 of [1, 2, 3, 4, 5, 6]
>>> dice2
3 of [1, 2, 3, 4, 5, 6]
>>> dice1.value
5
>>> dice2.value
3
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
AGStuff-1.1.0.tar.gz
(10.3 kB
view details)
Built Distribution
AGStuff-1.1.0-py3-none-any.whl
(15.5 kB
view details)
File details
Details for the file AGStuff-1.1.0.tar.gz
.
File metadata
- Download URL: AGStuff-1.1.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4569f3bc6b049c0b0ffdbf977059493d3abc12ca267ec111e473201e24f4fdd |
|
MD5 | 8537958d271dfa56fc94743fbe06a98a |
|
BLAKE2b-256 | bb1f73bd4b5b5235c11795ffea4d60a6c77c223a5b08a4b42e008f7bb51b986f |
File details
Details for the file AGStuff-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: AGStuff-1.1.0-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99d14f750b84cac7afebb58fe9c7162550652be790548dfca61e488e4ad5eb27 |
|
MD5 | c5c851f60cd645227b894b4d2f9d6af1 |
|
BLAKE2b-256 | 90f9ebba2000490d578d2c1340f07b7ac2559d2efee3fa866f7eaf1d54d643bf |