Skip to main content

A poker hand evaluation and equity calculation library

Project description

https://travis-ci.org/julianandrews/pyeval7.svg?branch=master

Python Texas Hold’em hand evaluation library based on Anonymous7’s codebase which is in turn based on Keith Rule’s hand evaluator (which you can see here). Eval7 also provides a parser for an extended set of PokerStove style range strings, and approximate equity calculation for unweighted ranges.

Eval7 is a work in progress: only the functionality needed by Flop Ferret has been fully implemented. Time permitting, the goal is to provide a fully featured poker hand evaluator and range equity calculator with a clean native python interface and all performance critical parts implemented in Cython.

Installation

Pip Installation

Check PyPI to see if there are recent binary .whl packages for your version of python. If there are, you can just install with:

pip install eval7

If there isn’t a wheel for your package, feel free to open an issue on GitHub.

Other Platforms

eval7 is tested on python 3.5, 3.6, 3.7 and 3.8 and likely works with 2.7+. The build process requires cython. If you have a working copy of pip:

pip install cython

should work on many platforms. Once you have cython, clone the repo and install with:

python setup.py install

Usage

Basic usage:

>>> import eval7, pprint
>>> deck = eval7.Deck()
>>> deck.shuffle()
>>> hand = deck.deal(7)
>>> pprint.pprint(hand)
[Card("5c"),
 Card("9s"),
 Card("8d"),
 Card("5d"),
 Card("Ac"),
 Card("Qc"),
 Card("3d")]
>>> eval7.evaluate(hand)
17025648
>>> eval7.handtype(17025648)
'Pair'

>>> hand = [eval7.Card(s) for s in ('As', '2c', '3d', '5s', '4c')]
>>> eval7.evaluate(hand)
67305472
>>> eval7.handtype(67305472)
'Straight'

Deck objects provide sample, shuffle, deal and peek methods. The deck code is currently implemented in pure python and works well for quick lightweight simulations, but is too slow for full range vs. range equity calculations. Ideally this code will be rewritten in Cython.

Hand Ranges

eval7 also provides a parser for weighted PokerStove style hand ranges.

Examples:

>>> from pprint import pprint
>>> hr = eval7.HandRange("AQs+, 0.4(AsKs)")
>>> pprint(hr.hands)
[((Card("Ac"), Card("Qc")), 1.0),
 ((Card("Ad"), Card("Qd")), 1.0),
 ((Card("Ah"), Card("Qh")), 1.0),
 ((Card("As"), Card("Qs")), 1.0),
 ((Card("Ac"), Card("Kc")), 1.0),
 ((Card("Ad"), Card("Kd")), 1.0),
 ((Card("Ah"), Card("Kh")), 1.0),
 ((Card("As"), Card("Ks")), 1.0),
 ((Card("As"), Card("Ks")), 0.4)]

>>> hr = eval7.HandRange("AJ+, ATs, KQ+, 33-JJ, 0.8(QQ+, KJs)")
>>> len(hr)
144

At present the HandRange objects are just a thin front-end for the range-string parser. Ultimately the hope is to add Cython backed sampling, enumeration, and HandRange vs. HandRange equity calculation.

Equity

eval7 also provides equity calculation functions: py_hand_vs_range_exact, py_hand_vs_range_monte_carlo and py_all_hands_vs_range. These don’t yet support weighted ranges and could probably benefit from optimization. See equity.pyx for documentaiton.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eval7-0.1.8.tar.gz (158.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

eval7-0.1.8-cp39-cp39-manylinux1_x86_64.whl (322.3 kB view details)

Uploaded CPython 3.9

eval7-0.1.8-cp38-cp38-win_amd64.whl (97.3 kB view details)

Uploaded CPython 3.8Windows x86-64

eval7-0.1.8-cp38-cp38-win32.whl (86.1 kB view details)

Uploaded CPython 3.8Windows x86

eval7-0.1.8-cp38-cp38-manylinux1_x86_64.whl (443.4 kB view details)

Uploaded CPython 3.8

eval7-0.1.8-cp38-cp38-macosx_10_14_x86_64.whl (89.1 kB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

eval7-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl (89.9 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

eval7-0.1.8-cp37-cp37m-win_amd64.whl (96.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

eval7-0.1.8-cp37-cp37m-win32.whl (84.6 kB view details)

Uploaded CPython 3.7mWindows x86

eval7-0.1.8-cp37-cp37m-manylinux1_x86_64.whl (397.1 kB view details)

Uploaded CPython 3.7m

eval7-0.1.8-cp37-cp37m-macosx_10_14_x86_64.whl (88.2 kB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

eval7-0.1.8-cp37-cp37m-macosx_10_9_x86_64.whl (88.9 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

eval7-0.1.8-cp36-cp36m-win_amd64.whl (95.7 kB view details)

Uploaded CPython 3.6mWindows x86-64

eval7-0.1.8-cp36-cp36m-win32.whl (84.4 kB view details)

Uploaded CPython 3.6mWindows x86

eval7-0.1.8-cp36-cp36m-manylinux1_x86_64.whl (317.0 kB view details)

Uploaded CPython 3.6m

eval7-0.1.8-cp36-cp36m-macosx_10_14_x86_64.whl (89.0 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

eval7-0.1.8-cp35-cp35m-manylinux1_x86_64.whl (310.1 kB view details)

Uploaded CPython 3.5m

File details

Details for the file eval7-0.1.8.tar.gz.

File metadata

  • Download URL: eval7-0.1.8.tar.gz
  • Upload date:
  • Size: 158.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8.tar.gz
Algorithm Hash digest
SHA256 d54f0cfe3cf643a467b984a5b24f9a5c6a094380dd4b314ae5f782c31cb43c55
MD5 a99616414edf10dc663d07156de6eb12
BLAKE2b-256 90e708c0d8b704681593db91cee04423e2943d479f8772ed18ca5ae9b61f91a8

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 322.3 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 51ebcafaf6cf1b94ff50167973243f9419e36a5cf8cc93d88b0a7f560db2aa33
MD5 e9d3f9a3f3c2a16f5c14539116b260a5
BLAKE2b-256 16714af36aad1f11adbdfa0b25fca2c10c9050af0a5cff35b520c29b9cccc4ad

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 97.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b1f1f61167f7754ef01656321ab81031911dfae9cbc177c569f7ead031492118
MD5 e1efe8c839fd0d50b8d92ffd8ad3bb7b
BLAKE2b-256 ef758ab513cb19d9a4fdaed0a11e7f4674b26bdc27b5340067f37c062054a9af

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp38-cp38-win32.whl.

File metadata

  • Download URL: eval7-0.1.8-cp38-cp38-win32.whl
  • Upload date:
  • Size: 86.1 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 3f277cc71911fc169f4f7dafbe6323e82a1cb1deca798ab879c048d8ebc51670
MD5 03b3ea592397a24e816919e3fa908b5f
BLAKE2b-256 2dd4597b4417205be0a93b5ab17f6a491949e7867dfbe31f52ec58d6eba2a230

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 443.4 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5e144bda091ffa926760881fbeb0c712c87b80d2346e07e3c1e70eecddd590ba
MD5 94a34b5e1f0e8fa3598f72cc6b26b874
BLAKE2b-256 b6a4f977049ce9179e66027be7dfe12bf02099eec530173a6344a129af0880c7

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 89.1 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 40e1e63c0e3c57eeef6b15d8b3549c67b83117b95adf1d556cebf8ab5e7bd066
MD5 b4712f315a2a9d1d172fd5aa8ae2998b
BLAKE2b-256 75774c9e4178431e8f100883e57021a90a1622ddddb0245c107950c412452f49

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 89.9 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for eval7-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b7724e462af1879b46f2085da796c593e10c6aa9fe68ff7e04259332da47dda1
MD5 1369b674d6da3bbe367886ba0480b824
BLAKE2b-256 370d7b32e5a6b5e214e8da34962c896a1e3702901485c5fc4acba65ec7915ad0

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 96.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d1437ab21c0f7c90531b4b2b678239e0b4b5c04e2c5816e62daf810e2f3f2fe4
MD5 bcc30d00cce8b4c5025767869418aacd
BLAKE2b-256 d74e25646cb2c9b0f4e5e4d0d9aed08a8fa8525f266302396a915f6ba4ca90a4

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp37-cp37m-win32.whl.

File metadata

  • Download URL: eval7-0.1.8-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 84.6 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 a2c358541a8f4186acdfaf8a19b775fd5c92b73cb63a7f3386feef1b3a1ddef0
MD5 0afb84a121ffbea83a92a4c3869679ec
BLAKE2b-256 9acc4a82f7a61d23f3f80b37996269507bea9fb8f744baad4599e6bcc5c463a0

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 397.1 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 13c021ee6e01b2db1c1d5519495e558782684ca051dca973beb7cece689c450f
MD5 c1f084042a5e18bfb5b2ccf7fe4c0987
BLAKE2b-256 402680acb54c1493c3efb1b65594e9c71f6634a228073ee0faecdb5cb13f118a

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 88.2 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 e3f6f2bfeaebb612736c375b47bf3421831a3105bdc5757e4aa60187f88845be
MD5 38f7fcb95ee318e193208a843ef7b049
BLAKE2b-256 38a52c11df0e778fff808807357504f84ef2df44e881feeb309d189a5cec3399

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 88.9 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for eval7-0.1.8-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0c6ced899cdf1892e2800640ac29eda23b6ad64020a0356862cc16ba09ef210b
MD5 df6c45562047c586605f075f21fd8765
BLAKE2b-256 f98c101cb62b9858e30662ea22730c05fde94c2f99860b3b6a5afcf6b1b4a9f6

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 95.7 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 33e7740f9c162b6fa85d3f8535f66a3de7c0cb82037ad5eb62d9938023d1bf70
MD5 afa6536afd357dada03949e5c10c6071
BLAKE2b-256 93b666dbd4d39fbb1d50ab056546c5f8246332193dee3a087851287b72e80833

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp36-cp36m-win32.whl.

File metadata

  • Download URL: eval7-0.1.8-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 84.4 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 6f1d8b3d8167fae3b6eb1dc44416706be0cac51475a91f879e92d01106c342b1
MD5 cacde4bc0e1fa0470fc8341442dd3a89
BLAKE2b-256 a58bb90afb6caf16dde1052e0e052d48acc9d14581156687b1fcd973ea9d0f1b

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 317.0 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 69234dc2c01e8051c9b0550466e5977c86ca43344a67a4a187029a9f36956ca2
MD5 158031fa53b3471a117fd92227a31bd7
BLAKE2b-256 49e8735a9dd9b94a0b36bf0e38c5aaebdd1cc8bb5bbdc1db1ed025dd036b8948

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 89.0 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 51d21712b1a5b853959e3f44e09e0b8c5031e45827b2163aa6bd4222ce9ca4f3
MD5 11b25128b8f0d7df77b0834103a36ba0
BLAKE2b-256 164dcb41cd02f6b99d99e0a593ce7c32f41d41a70492cc20a4f3a85b0bae8fac

See more details on using hashes here.

File details

Details for the file eval7-0.1.8-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: eval7-0.1.8-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 310.1 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for eval7-0.1.8-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3871fe7fa2983d613ca3a24d3e124a049b798cdeb6869e82e57d9d7fdc3220bb
MD5 e66f2b8ceb021872060bb5e04e3b7175
BLAKE2b-256 5f8e980a89fb56ecf7366d46b203765abcdec278e51bc2b0f8ae4facda30d8a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page