Skip to main content

bluff

Bluff is a pythonic poker framework.

PyPi Version MIT License

Currently, bluff covers the following poker variants:

  • Texas Hold'em
  • Chinese Poker

Getting Started

Installation

Use the package manager pip to install Bluff.

pip install bluff

Usage

Evaluating hands

import bluff

# Hands can be created by passing Card instances as arguments.
hand1 = bluff.Hand(
    bluff.Card("5d"),
    bluff.Card("4s"),
    bluff.Card("5s"),
    bluff.Card("4c"),
    bluff.Card("5h"),
)

hand1.name
>>> "full_house"

Comparing hands values

import bluff

# Hands can also be created by passing their string representations.
hand1 = bluff.Hand("5d", "4s", "5s", "4c", "5h")
# Concatenated strings are also accepted.
hand2 = bluff.Hand("Jh", "Td", "Js", "5s", "8d")

hand1.value > hand2.value
>>> True

Drawing a card for a player

import bluff

player = bluff.Player(name="Chris Moneymaker", chips=10000)
deck = bluff.Deck()
card = deck.draw()
player.hand.add(card)

Evaluating equity with Monte Carlo

from bluff.holdem import equity

equity.equity(("QQ", "AKo"), times=10000)

Evaluating a hand equity against several ranges

from bluff.holdem import equity

# Ranges descriptions.
equity.eval_ranges("JTs", ("KQs ATo 99", "AKs QQ"), times=10000)
# Ranges percentages.
equity.eval_ranges("JTs", (10, 30), times=10000)

For more information see the documentation.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Author

License

This project is licensed under the MIT License.

Metadata

Release files for bluff 1.0.2

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

Built distribution (wheel)

Table of built distributions (wheels) for bluff 1.0.2
File Interpreter ABI Platform
bluff-1.0.2-py3-none-any.whl Python 3 none any Details

Release files / bluff-1.0.2-py3-none-any.whl

Download URL bluff-1.0.2-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8e5d454e7b391e09293a550a70c3e10fd81641ea67cc0c26b8ac76662f2b8c37
BLAKE2b-256 checksum
How to use checksums
5d45a9ca3f787c3d18130409f93f7e738038093be23af12f39dbf80caa84b551
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

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