endplay.types.board

Classes:

Board([deal, auction, play, board_num, vul, ...])

Class representing a deal along with the play, auction and other table information

class endplay.types.board.Board(deal: Optional[Deal] = None, auction: Optional[Iterable[Bid]] = None, play: Optional[Iterable[Card]] = None, board_num: Optional[int] = None, *, vul: Optional[Vul] = None, dealer: Optional[Player] = None, contract: Optional[Contract] = None, claimed: bool = False, **kwargs)

Bases: object

Class representing a deal along with the play, auction and other table information

Variables:
  • deal (Deal) – The deal at the table

  • auction (list[Bid]) – The auction at the table

  • contract (Contract) – The contract at the table

  • play (list[Card]) – The play history at the table

  • board_num (int) – The board number of this deal

  • vul (Vul) – The board vulnerability. If this isn’t defined (i.e. set to None) then it is deduced from board_num

  • dealer (Player) – The board dealer. Similarly to vul this can be deduced from board_num

  • claimed (bool) – Flag indicating whether the play ended as a result of a claim

  • info

    A dictionary which contains arbitrary extra information about the board. The dictionary type used provided case-insensitive dot-access as a convenience (i.e. board.info.event and board.info.Event refer to the same object, but board.info[“event”] and board.info[“Event”] would be considered different). Tabular data can be stored here, any key ending with (but not equal to) table is treated as a table and its value should be a dictionary containing two keys: headers with a list of column names, and rows with a list of the rows. The column names can either be plain strings, or dictionaries with the keys

    • ordering: Either “+”, “-” or None depending of if the table is sorted

      ascending, descending or unsorted with respect to this column

    • name: A string value with the name of the column

    • minwidth: The minimum width that values in this column should be

    • alignment: “L” or “R” depending on if this column should be left or right

      aligned. Ignored unless minwidth is defined

Classes:

Info

Dictionary-like class which alows for case-insensitive dot-access, for example.

Attributes:

contract

The contract the board was played in.

dealer

Dealer of the board.

vul

Vulnerability of the board.

class Info

Bases: dict

Dictionary-like class which alows for case-insensitive dot-access, for example:

info["Event"] = "WBF 2017"
print(info.event) # WBF 2017

Methods:

_find_key(key)

_find_key(key: str)
property contract: Optional[Contract]

The contract the board was played in. If not provided, then attempts to calculate based on the auction and play history.

property dealer: Optional[Player]

Dealer of the board. If not defined, then attempts to calculate based on the value of board_num

property vul: Optional[Vul]

Vulnerability of the board. If not defined, then attempts to calculate based on the value of board_num