Skip to main content

Fast poker hand evaluation library with eval7-compatible API

Project description

pkrbot

Fast poker hand evaluator. Drop-in replacement for eval7, 2-3x faster.

Install

pip install pkrbot

Usage

import pkrbot

# Evaluate a hand
hand = [pkrbot.Card('As'), pkrbot.Card('Kh'), pkrbot.Card('Qd'), pkrbot.Card('Jc'), pkrbot.Card('Ts')]
result = pkrbot.evaluate(hand)
print(pkrbot.handtype(result))  # "Straight"

# Use a deck
deck = pkrbot.Deck()
deck.shuffle()
hand = deck.deal(7)
result = pkrbot.evaluate(hand)

API

Cards: pkrbot.Card('As') - Ranks: 2-9, T, J, Q, K, A, Suits: c, d, h, s

Deck:

  • deck.shuffle() - Randomize
  • deck.deal(n) - Remove and return n cards
  • deck.peek(n) - View top n cards
  • deck.sample(n) - Get n random cards

Evaluate: result = pkrbot.evaluate(hand) - Higher values = better hands

Hand Type: pkrbot.handtype(result) - Returns: "Straight Flush", "Quads", "Full House", "Flush", "Straight", "Trips", "Two Pair", "Pair", "High Card"

Performance

~2-3x faster than eval7. Optimized Cython with aggressive compiler flags.

License

MIT

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

pkrbot-1.0.0.tar.gz (179.9 kB view details)

Uploaded Source

Built Distribution

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

pkrbot-1.0.0-cp313-cp313-macosx_14_0_arm64.whl (83.1 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

File details

Details for the file pkrbot-1.0.0.tar.gz.

File metadata

  • Download URL: pkrbot-1.0.0.tar.gz
  • Upload date:
  • Size: 179.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for pkrbot-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c9d7943d83700b239e278a2a92d42f34a8e5951dd82ba6ff6df92595536c7add
MD5 b0a9dab1f1377036484ced7cbabb297c
BLAKE2b-256 d12f7a8cb575c5641abcbfe13465e61a5c459eb15e8421ef6d1be2a377e263a5

See more details on using hashes here.

File details

Details for the file pkrbot-1.0.0-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pkrbot-1.0.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 48cd7b4a29be36912352bfb18d1fa3de0cab9161732f41c121c0b58fd8bf055e
MD5 8536c6ffb1ffbaf19daa20d8747930fb
BLAKE2b-256 275fa3c91ae3dc5c17904582d988e6c870296577d434ff5c21dbb7116d1644d8

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