dominicprice / endplay

A suite of tools for generation and analysis of bridge deals. Read the documentation at https://endplay.readthedocs.io
MIT License
22 stars 5 forks source link

Quick Trick Count? #21

Open BSalita opened 1 year ago

BSalita commented 1 year ago

I don't see a function to return quick trick count in the evaluate namespace. Does something exist which I can use?

If not available, I can just fallback to the following code:

qtl = [(2,'AK'),(1.5,'AQ'),(1,'A'),(1,'KQ'),(0.5,'K')] # list of (quick tricks card combos, combo value)
qtls = sorted(qtl,reverse=True) # sort by quick trick value (most to least) to avoid ambiguity
def SuitToQT(suit):
    # assumes suits are sorted by HCP value (most to least) (AKQJT...)
    for qt in qtls:
        if suit.startswith(qt[1]):
            return qt[0]
    return 0