Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.05 KB

README.md

File metadata and controls

72 lines (49 loc) · 1.05 KB

pywhist

A package containing the logic for the card game Whist and its variants.

How to install

pip install whist

How to use

whist contains a wide range of utility to work with playing cards and perform Whist game logic.

Playing with cards

>>> from whist.cards import Deck
>>> deck = Deck.full_deck()
>>> deck.shuffle()
>>> cards = [card.symbol for card in deck.cards]
>>> print(cards[:3])
['🃙', '🂥', '🂦']

Interactive play

$ 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: 🂫
>

How to test

Install pytest (see requirements-dev.txt).

Then

pytest