endplay.types.contract

Classes:

Contract([data, level, denom, declarer, ...])

Class representing a specific contract

class endplay.types.contract.Contract(data: Optional[Union[contractType, str]] = None, *, level: Optional[int] = None, denom: Optional[Denom] = None, declarer: Optional[Player] = None, penalty: Optional[Penalty] = None, result: Optional[int] = None)

Bases: object

Class representing a specific contract

Attributes:

_pat

declarer

The declarer of the contract

denom

The denomination of the contract

level

The level of the contract

result

The number of tricks over or under the contract made

Methods:

copy()

Return a copy of this contract object

from_auction(dealer, auction)

Construct a contract from a bidding sequence

is_passout()

Returns true if the contract represents a passout

score(vul)

The number of points the contract would score for the declarer

_pat = re.compile('^([1-7])((?:NT?)|S|H|D|C)([NSEW]?)((?:XX|X|D|R)?)((?:=|(?:[+-]\\d+))?)$')
copy() Contract

Return a copy of this contract object

property declarer: Player

The declarer of the contract

property denom: Denom

The denomination of the contract

static from_auction(dealer: Player, auction: Sequence[Bid])

Construct a contract from a bidding sequence

is_passout() bool

Returns true if the contract represents a passout

property level: int

The level of the contract

property result: int

The number of tricks over or under the contract made

score(vul: Vul) int

The number of points the contract would score for the declarer