A package containing the logic for the card game Whist and its variants.
pip install whist
whist
contains a wide range of utility to work with playing cards and perform Whist game logic.
>>> from whist.cards import Deck
>>> deck = Deck.full_deck()
>>> deck.shuffle()
>>> cards = [card.symbol for card in deck.cards]
>>> print(cards[:3])
['🃙', '🂥', '🂦']
$ python -m whist.cli
=== Turn: north ===
east: 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠
south: 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠
west: 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠 🂠
Your partner: south
Pile:
Your hand: 🃖 🃛 🃂 🃆 🃇 🃋 🂴 🂹 🂺 🂽 🂢 🂩 🂫
Actions:
0: 🃖
1: 🃛
2: 🃂
3: 🃆
4: 🃇
5: 🃋
6: 🂴
7: 🂹
8: 🂺
9: 🂽
10: 🂢
11: 🂩
12: 🂫
>
Install pytest
(see requirements-dev.txt
).
Then
pytest