Skip to main content

pokyr

This is a python library that provides routines for very fast poker hand comparisons to power hand match ups.

Pure python and c-extention modules are included. Using the cpoker module it should be easy to write python code that will, for example, quickly caluculate expected hand strength squared and opponent cluster hand strength (EHS2/OCHS).

The rank lookup sceme uses 13 magic numbers attributed to the specialK blog, which I used to supplement my own algorithm. A pure python lite version is also included that leaves a small memory footprint and is still fast.

Sample

Cards are represented by intergers 0-51 and groups of cards are contained in lists. The pretty_args wrapper allows you to use standard card strings rather than integers. You can also convert from integers to pretty cards and back with utils.make_pretty and utils.to_cards.

>>> from poker import cpoker
>>> from poker import utils
>>> #return the evs of a match between any number of hands
>>> enum = utils.pretty_args(cpoker.full_enumeration)
>>> enum(["AsKd", "8c2s"])
[0.6753362720638392, 0.32466372793616083]
>>> enum(["AsKd", "7h 8h", "6c 6d"], "Kc 6h 9h")
[0.021040974529346623, 0.44518272425249167, 0.5337763012181617]
>>> # percentile on river vs all 990 hand combos
>>> utils.pretty_args(cpoker.rivervalue)("As Kd", "Ks Qh Jc 8s 8d")
0.8585858585858586
>>> utils.make_pretty([7, 8, 9])
'Ks Qc Qd'
>>> utils.to_cards('Ks Qc Qd')
[7, 8, 9]

Compile and Install

If you have a c compiler the python dev tools for your system then hopefully this does it. All you need is python 2 or 3 to run the pure python modules.

$ python setup.py install

Metadata

Release files for pokyr 0.1.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pokyr 0.1.25
File Size Uploaded
pokyr-0.1.25.tar.gz 31.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pokyr 0.1.25
File Interpreter ABI Platform
pokyr-0.1.25-py3.7-macosx-10.15-x86_64.egg Legacy Egg format - - Details
pokyr-0.1.25-py2.7-macosx-10.15-x86_64.egg Legacy Egg format - - Details

Total release size: 132.8 kB

Release files / pokyr-0.1.25.tar.gz

Download URL pokyr-0.1.25.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3a9da06fc9375927558ebb86b65ac61952bdbac77eb417d025ff8246b002feea
BLAKE2b-256 checksum
How to use checksums
441563d34d82fb96d84630f278437763879c88d49bbdf58e9210b78bf3f9feb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7

Release files / pokyr-0.1.25-py3.7-macosx-10.15-x86_64.egg

Download URL pokyr-0.1.25-py3.7-macosx-10.15-x86_64.egg
Size 52.8 kB
Tags Egg
SHA-256 checksum
How to use checksums
435031487d156e57b28e98b1cc99f8407f29abbd11143522d0e4024b33eeed26
BLAKE2b-256 checksum
How to use checksums
61c9b1a3d8958f0001d1ac3ef43164c36e02db6477d665e622b8e7cb678038b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7

Release files / pokyr-0.1.25-py2.7-macosx-10.15-x86_64.egg

Download URL pokyr-0.1.25-py2.7-macosx-10.15-x86_64.egg
Size 48.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
80ca3fd2622b7c92092e3af55eefcf853150a9ce439e64e3e814107884f380d5
BLAKE2b-256 checksum
How to use checksums
8cb0d510f62ce2e31acd6f99a8e15f658d3f95c8dd8ed2483e243ec5847de4c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.1.25 This release

3 release files

0.1.24

3 release files

0.1.2

3 release files

0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page