Introduction
A DDS (double-dummy solver) function is available through Bo Haglund's DDS 2.9.0. For Windows, the DDS DLL is distributed with are distributed together.
The solution used here is copied from below two opensource project, credit to them
this project focus on DDS table only like below
$ ./ddstable.py
S H D C NT
N - 4 2 - 3
S - 4 2 - 3
E 3 - - - -
W 3 - - - -
How to use it
from ddstable import ddstable
PBN = b"E:QJT5432.T.6.QJ82 .J97543.K7532.94 87.A62.QJT4.AT75 AK96.KQ8.A98.K63"
all = ddstable.get_ddstable(PBN)
print("{:>5} {:>5} {:>5} {:>5} {:>5} {:>5}".format("", "S", "H", "D", "C", "NT"))
# may use card_suit=["C", "D", "H", "S", "NT"]
for each in all.keys():
print("{:>5}".format(each),end='')
for suit in ddstable.dcardSuit:
trick=all[each][suit]
if trick>7:
print(" {:5}".format(trick - 6),end='')
else:
print(" {:>5}".format("-"),end='')
print("")
or
>>> from ddstable import ddstable
>>> PBN = b"E:QJT5432.T.6.QJ82 .J97543.K7532.94 87.A62.QJT4.AT75 AK96.KQ8.A98.K63"
>>> ddstable.get_ddstable(PBN)
{'N': {'S': 4, 'H': 10, 'D': 8, 'C': 6, 'NT': 9}, 'S': {'S': 4, 'H': 10, 'D': 8, 'C': 6, 'NT': 9}, 'E': {'S': 9, 'H': 2, 'D': 3, 'C': 7, 'NT': 3}, 'W': {'S': 9, 'H': 2, 'D': 3, 'C': 7, 'NT': 3}}
Reference
Release files for ddstable 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ddstable-0.2.0.tar.gz | 242.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ddstable-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:485.3 kB
Release files / ddstable-0.2.0.tar.gz
| Download URL | ddstable-0.2.0.tar.gz |
|---|---|
| Size | 242.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0839e3898303cb8dc9a68b8b78b1a649e803028e432719cd00806be36e6a9e7
|
|
BLAKE2b-256 checksum How to use checksums |
b793944b0c93e8d193a61155bceae7e80fced3ed82c602f48364b1137808f2bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|
Release files / ddstable-0.2.0-py3-none-any.whl
| Download URL | ddstable-0.2.0-py3-none-any.whl |
|---|---|
| Size | 242.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dafa3bf5b7e1d1aae4550cf53405eb2353e5182c147d2885676d270883069ab9
|
|
BLAKE2b-256 checksum How to use checksums |
e9e4564f8f6ab47ec16dd64b38193b5e889808cfaa3aaaa32768d02744c1a134
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|