PeterSR / pywhist

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:MIT License


Languages

Language:Python 100.0%