deck-3.1.0b1
توضیحات
Implementation of the deck collection type.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | deck-3.1.0b1 |
| نام | deck |
| نسخه کتابخانه | 3.1.0b1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Steve Dower |
| ایمیل نویسنده | steve.dower@python.org |
| آدرس صفحه اصلی | http://github.com/zooba/deck |
| آدرس اینترنتی | https://pypi.org/project/deck/ |
| مجوز | - |
Deck
====
[](https://github.com/ambv/black)
Deck is an implementation of the `deck` collection type, commonly confused with [`collections.deque`](https://docs.python.org/3/library/collections.html#collections.deque).
```python
>>> from deck import Deck
>>> d = Deck()
>>> d.shuffle()
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Two: 2>)
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Three: 3>)
>>> d.deal()
Card(<Suit.Hearts: '♥'>, <Value.Ten: 10>)
>>> d.deal()
Card(<Suit.Diamonds: '♦'>, <Value.Nine: 9>)
```
Deck supports cheating, if that's how you want to play.
```python
>>> d.deal_from_bottom()
Card(<Suit.Spades: '♠'>, <Value.Five: 5>)
```
Importing the `deck` module also globally corrects other typographical errors that may occur in your code.
```python
>>> import deck
>>> from collections import deck
>>> deck
<class 'deck.Deck'>
```
**Taking this module too seriously would be a mistake.**
However, if you want to use it to write a Poker game, the `get_poker_hand` function will help.
```python
>>> from deck import Deck, get_poker_hand
>>> d = Deck(include_jokers=False)
>>> d.shuffle()
>>> p1 = [d.deal() for _ in range(5)]
>>> p2 = [d.deal() for _ in range(5)]
>>> if get_poker_hand(p1) > get_poker_hand(p2):
... print("Player 1 wins!")
...
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl deck-3.1.0b1:
pip install deck-3.1.0b1.whl
نصب پکیج tar.gz deck-3.1.0b1:
pip install deck-3.1.0b1.tar.gz