bluff


Namebluff JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/matheusccouto/bluff
SummaryBluff is a pythonic poker framework
upload_time2020-08-06 02:36:48
maintainer
docs_urlNone
authorMatheus Couto
requires_python>=3.6
license
keywords poker
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bluff
Bluff is a pythonic poker framework.

[![PyPi Version](https://img.shields.io/pypi/v/bluff.svg)](https://pypi.python.org/pypi/bluff/)
[![MIT License](https://img.shields.io/github/license/matheusccouto/bluff)](https://github.com/matheusccouto/bluff/blob/master/LICENSE)

Currently, bluff covers the following poker variants:
* Texas Hold'em
* Chinese Poker

## Getting Started
### Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install Bluff.
```bash
pip install bluff
```
### Usage
#### Evaluating hands
```python
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
```python
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
```python
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
```python
from bluff.holdem import equity

equity.equity(("QQ", "AKo"), times=10000)
```
#### Evaluating a hand equity against several ranges
```python
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](https://matheusccouto.github.io/bluff/).

## 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

* **Matheus Couto** - [Linkedin](https://www.linkedin.com/in/matheusccouto/)

## License
This project is licensed under the [MIT](https://choosealicense.com/licenses/mit/) License.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/matheusccouto/bluff",
    "name": "bluff",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "poker",
    "author": "Matheus Couto",
    "author_email": "matheusccouto@gmail.com",
    "download_url": "",
    "platform": "",
    "description": "# bluff\nBluff is a pythonic poker framework.\n\n[![PyPi Version](https://img.shields.io/pypi/v/bluff.svg)](https://pypi.python.org/pypi/bluff/)\n[![MIT License](https://img.shields.io/github/license/matheusccouto/bluff)](https://github.com/matheusccouto/bluff/blob/master/LICENSE)\n\nCurrently, bluff covers the following poker variants:\n* Texas Hold'em\n* Chinese Poker\n\n## Getting Started\n### Installation\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install Bluff.\n```bash\npip install bluff\n```\n### Usage\n#### Evaluating hands\n```python\nimport bluff\n\n# Hands can be created by passing Card instances as arguments.\nhand1 = bluff.Hand(\n    bluff.Card(\"5d\"),\n    bluff.Card(\"4s\"),\n    bluff.Card(\"5s\"),\n    bluff.Card(\"4c\"),\n    bluff.Card(\"5h\"),\n)\n\nhand1.name\n>>> \"full_house\"\n```\n#### Comparing hands values\n```python\nimport bluff\n\n# Hands can also be created by passing their string representations.\nhand1 = bluff.Hand(\"5d\", \"4s\", \"5s\", \"4c\", \"5h\")\n# Concatenated strings are also accepted.\nhand2 = bluff.Hand(\"Jh\", \"Td\", \"Js\", \"5s\", \"8d\")\n\nhand1.value > hand2.value\n>>> True\n```\n\n#### Drawing a card for a player\n```python\nimport bluff\n\nplayer = bluff.Player(name=\"Chris Moneymaker\", chips=10000)\ndeck = bluff.Deck()\ncard = deck.draw()\nplayer.hand.add(card)\n```\n#### Evaluating equity with Monte Carlo\n```python\nfrom bluff.holdem import equity\n\nequity.equity((\"QQ\", \"AKo\"), times=10000)\n```\n#### Evaluating a hand equity against several ranges\n```python\nfrom bluff.holdem import equity\n\n# Ranges descriptions.\nequity.eval_ranges(\"JTs\", (\"KQs ATo 99\", \"AKs QQ\"), times=10000)\n# Ranges percentages.\nequity.eval_ranges(\"JTs\", (10, 30), times=10000)\n```\n\nFor more information see the [documentation](https://matheusccouto.github.io/bluff/).\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n\n## Author\n\n* **Matheus Couto** - [Linkedin](https://www.linkedin.com/in/matheusccouto/)\n\n## License\nThis project is licensed under the [MIT](https://choosealicense.com/licenses/mit/) License.\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Bluff is a pythonic poker framework",
    "version": "1.0.2",
    "split_keywords": [
        "poker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c0717715cbc12cbc8de04efa954b96a0",
                "sha256": "8e5d454e7b391e09293a550a70c3e10fd81641ea67cc0c26b8ac76662f2b8c37"
            },
            "downloads": -1,
            "filename": "bluff-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0717715cbc12cbc8de04efa954b96a0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 1073719,
            "upload_time": "2020-08-06T02:36:48",
            "upload_time_iso_8601": "2020-08-06T02:36:48.485996Z",
            "url": "https://files.pythonhosted.org/packages/5d/45/a9ca3f787c3d18130409f93f7e738038093be23af12f39dbf80caa84b551/bluff-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-08-06 02:36:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "matheusccouto",
    "error": "Could not fetch GitHub repository",
    "lcname": "bluff"
}
        
Elapsed time: 0.18348s