endplay.types.hand

Classes:

Hand([data])

Class allowing manipulations of cards in the hand of a single player

class endplay.types.hand.Hand(data: Union[str, Array[c_uint]] = '...')

Bases: object

Class allowing manipulations of cards in the hand of a single player

Methods:

add(card)

Adds a card to the hand

clear()

Remove all cards from the hand

copy()

extend(cards)

Add multiple cards to the hand

from_lin(lin)

Construct a Hand from a LIN string

from_pbn(pbn)

Construct a Hand from a PBN string

pprint([vertical, stream])

Print the suits in the hand using suit symbols

remove(card)

Remove a card from the hand

to_LaTeX([vertical, ten_as_letter])

Create a LaTeX representation of the hand.

to_lin()

Convert a Hand to a LIN string

to_pbn()

return:

A PBN representation of the hand

Attributes:

clubs

The club holding of the hand

diamonds

The diamond holding of the hand

hearts

The heart holding of the hand

spades

The spade holding of the hand

add(card: Card) bool

Adds a card to the hand

Parameters:

card – The card to be added to the hand

Returns:

False if the card was already in the hand, True otherwise

clear() None

Remove all cards from the hand

property clubs: SuitHolding

The club holding of the hand

copy() Hand
property diamonds: SuitHolding

The diamond holding of the hand

extend(cards: Iterable[Card]) int

Add multiple cards to the hand

Parameters:

cards – An iterable of the cards to add

Returns:

The number of cards successfully added

static from_lin(lin: str) Hand

Construct a Hand from a LIN string

Parameters:

lin – A LIN string for a hand, e.g. “SQT62HDAQT852CQJT”

static from_pbn(pbn: str) Hand

Construct a Hand from a PBN string

Parameters:

pbn – A PBN string for a hand, e.g. “QT62..AQT852.QJT”

property hearts: SuitHolding

The heart holding of the hand

pprint(vertical: bool = True, stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) None

Print the suits in the hand using suit symbols

remove(card: Card) bool

Remove a card from the hand

Parameters:

card – The card to be added to the hand, can be a string representation e.g. “CQ”

Returns:

False if the card wasn’t in the hand, True otherwise

property spades: SuitHolding

The spade holding of the hand

to_LaTeX(vertical: bool = True, ten_as_letter: bool = False) str

Create a LaTeX representation of the hand.

Parameters:
  • vertical – If True uses vhand, else hhand layout

  • title – The hand title. If vertical is False this is ignored

to_lin() str

Convert a Hand to a LIN string

to_pbn() str
Returns:

A PBN representation of the hand