Overview of submodules
endplay is divided into six main components, each of which can interoperate with each other:
endplay.typesis the basis for the whole library, providing the classes which are used by all the other modules for encapsulating the key objects in bridge. The ‘master’ class isDeal, whose state consists of the four hands in the deal, the cards played to the current trick, a trump suit and the player to lead to the current trick. All the methods one would expect to be defined on this are provided - accessing the hands, playing/unplaying cards from the current trick, importing and exporting from PBN format etc. From this class there is a hierarchy of typesDeal -> Hand -> SuitHolding -> Rankwhich allows introspection of the deal at any level wanted. Many other types, such as containers for holding results from double dummy analysis and storing contracts, are also provided here.endplay.dealerprovides functions for generating bridge hands. The main function isgenerate_dealswhich can accept a list of constraints (either functions which accept aDealobject and returnTrue/False, or strings written in dealer syntax) and generates a specified number of deals which satisfy the constraints. Thedealermodule can also be run as a main module withpython3 -m endplay.dealer(or simplyendplay-dealer) which works very similarly to the Hans van Staveren dealer program, but with some different output options and extra functionality.endplay.evaluateis the simplest component, consisting of a variety of functions which evaluate various properties of bridge hands, such as calculating high card points, shape, losers, controls and other algorithms for estimating the quality of a hand.endplay.ddsis a high-level wrapper around Bo Haglund’s dds library which takes care of converting between the different types and encodings it uses internally and providing sensible defaults for things such as the number of threads it uses. A lower level wrapperendplay._dds, which is little more than the basicctypesdeclarations, is also provided and is used internally by the dds functions when making library calls.endplay.parsersprovides tools for parsing common file types which are used as inputs and outputs for bridge software, this includes PBN and Dealer. These produce document tree representation of the input files and are used internally for many things, but can also be traversed manually to create programs which interact with other bridge software easily.endplay.interactprovides theCommandObjectclass which keeps an undo stack whenever its state is modified, making it easier to interact with the deal. The main purpose of the module is to provide a tool to create interactive deal programs, such as the main module (python3 -m endplay.interactorendplay-interact) which provides a a set of frontends analysing bridge deals.