endplay.dds

Higher-level wrappers around Bo Haglund’s dds wrapper, using the Python types defined in endplay.types and which use sensible defaults for the internal state such as threading indexes.

Functions:

analyse_all_plays(deals, plays[, ...])

Optimized version of analyse_play for multiple deals which uses threading to speed up the calculation

analyse_all_starts(deals[, declarer_is_first])

Optimized version of analyse for multiple deals which uses threading to speed up the calculation

analyse_play(deal, play[, declarer_is_first])

Calculate a list of double dummy values after each card in play is played to the hand.

analyse_start(deal[, declarer_is_first])

Calculate the most tricks declarer can make.

calc_all_tables(deals[, exclude])

Optimized version of calc_dd_table for multiple deals which uses threading to speed up the calculation.

calc_dd_table(deal)

Calculates the double dummy results for all 20 possible combinations of dealer and trump suit for a given deal

par(deal, vul, dealer)

Calculate the par contract result for the given deal.

solve_all_boards(deals[, target])

Optimized version of solve_board for multiple deals which uses threading to speed up the calculation

solve_board(deal[, target])

Calculate the double dummy score for all cards in the hand which is currently to play in a given deal

endplay.dds.analyse_all_plays(deals: Iterable[Deal], plays: Iterable[Iterable[Card]], declarer_is_first: bool = False) SolvedPlayList

Optimized version of analyse_play for multiple deals which uses threading to speed up the calculation

endplay.dds.analyse_all_starts(deals: Iterable[Deal], declarer_is_first: bool = False) list[int]

Optimized version of analyse for multiple deals which uses threading to speed up the calculation

endplay.dds.analyse_play(deal: Deal, play: Iterable[Union[Card, str]], declarer_is_first: bool = False) SolvedPlay

Calculate a list of double dummy values after each card in play is played to the hand. This returns len(play)+1 results, as there is also a result before any card has been played

endplay.dds.analyse_start(deal: Deal, declarer_is_first: bool = False) int

Calculate the most tricks declarer can make.

Parameters:
  • deal – The deal to analyse

  • declarer_is_first – The algorithm assumes that the person who leads is to the left of the declarer (as would be the case with the first card led to a hand), but to return the result as seen from the leader’s perspective you can set this to True

endplay.dds.calc_all_tables(deals: Iterable[Deal], exclude: Iterable[Denom] = []) DDTableList

Optimized version of calc_dd_table for multiple deals which uses threading to speed up the calculation. exclude can contain a list of denominations to exclude from the calculation, e.g. if only the notrump results for the deals is required then pass Denom.suits()

endplay.dds.calc_dd_table(deal: Deal) DDTable

Calculates the double dummy results for all 20 possible combinations of dealer and trump suit for a given deal

endplay.dds.par(deal: Union[Deal, DDTable], vul: Union[Vul, int], dealer: Player) ParList

Calculate the par contract result for the given deal.

Parameters:
  • deal – The deal to calculate the par result of. If you have already precomputed a DDTable for a deal then you speed up the par calculation by passing that instead of the Deal object

  • vul – The vulnerability of the deal. If you pass an int then this is converted from a board number into the vulnerability of that board

  • dealer – The dealer of the board.

endplay.dds.solve_all_boards(deals: Iterable[Deal], target: Optional[int] = None) SolvedBoardList

Optimized version of solve_board for multiple deals which uses threading to speed up the calculation

Parameters:
  • deals – The collection of boards to be solved, each with first and trump filled

  • target – If provided, only return cards which can make at least this many tricks

endplay.dds.solve_board(deal: Deal, target: Optional[int] = None) SolvedBoard

Calculate the double dummy score for all cards in the hand which is currently to play in a given deal

Parameters:
  • deal – The deal to solve, with first and trump filled in

  • target – If provided, only return cards which can make at least this many tricks