whist_core.game.hand

Hand of whist

Classes

Hand

Hand of whist.

Module Contents

class whist_core.game.hand.Hand

Bases: pydantic.BaseModel

Hand of whist.

tricks: list[whist_core.game.trick.Trick] = []
trump: whist_core.cards.card.Suit
done()

Check if the hand is done. :return: True if the hand is done, else False :rtype: bool

Return type:

bool

property current_trick

Returns the current trick.

static deal(play_order)

Deals the hand and starts the first trick. :return: the first trick :rtype: Trick

Parameters:

play_order (whist_core.game.play_order.PlayOrder)

Return type:

Hand

next_trick(play_order)

Starts the next trick. :return: the next trick :rtype: Trick

Parameters:

play_order (whist_core.game.play_order.PlayOrder)

Return type:

whist_core.game.trick.Trick

dict(*args, **kwargs)

Returns as dictionary.

model_dump(*, mode='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)

Returns as dictionary.

Parameters:
  • mode (Literal['json', 'python'] | str)

  • by_alias (bool | None)

  • exclude_unset (bool)

  • exclude_defaults (bool)

  • exclude_none (bool)

  • round_trip (bool)

  • warnings (bool | Literal['none', 'warn', 'error'])

  • fallback (Callable[[Any], Any] | None)

  • serialize_as_any (bool)

Return type:

dict[str, Any]

_winner_plays_first_card(play_order)
Parameters:

play_order (whist_core.game.play_order.PlayOrder)

Return type:

whist_core.game.play_order.PlayOrder