{ "info": { "author": "Yegor Bitensky", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Education", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Games/Entertainment" ], "description": "# Texas Hold'em Poker tool\n\n## Install\n\n`pip install THPoker`\n\n### Requirements\n\n* Python 3.6 or higher\n\n## Usage\n\n### Core\n\n*Core is the main project module that contains base functional to work with Texas Hold'em Poker*\n\n> Since 1.1.0 version there isn't Card and Deck in THPoker core, they uses from [AGStuff](https://github.com/YegorDB/AGStuff).\n\n#### Cards(cards_string=None, cards=None)\n\nSeveral cards (7 or less).\n\n> Since 1.1.0 version base on [AGStuff](https://github.com/YegorDB/AGStuff) Cards.\n\n#### Table(cards_string=None, cards=None)\n\nSeveral cards on the table\n\nTable is the same as the Cards, except that the Table can contain no more than 5 items\n\n#### Hand(cards_string=None, cards=None)\n\nPlayer's hand cards\n\nHand is the same as the Cards, except that the Hand can contain no more than 2 items and it has additional attributes (hand type and whether hand is a pair or not)\n\n```python\n>>> from thpoker.core import Hand\n\n>>> hand1 = Hand(\"Ad/Js\")\n>>> hand1.type\n'AJo'\n>>> hand1.is_pair\nFalse\n\n>>> hand2 = Hand(\"7c/Tc\")\n>>> hand2.type\n'T7s'\n>>> hand2.is_pair\nFalse\n\n>>> hand3 = Hand(\"2s/2h\")\n>>> hand3.type\n'22'\n>>> hand3.is_pair\nTrue\n```\n\n#### Combo(cards_string=None, cards=None, table=None, hand=None, nominal_check=False)\n\nCards combination.\n\nThere are 9 combinations: `Combo.HIGH_CARD`, `Combo.ONE_PAIR`, `Combo.TWO_PAIRS`, `Combo.THREE_OF_A_KIND`, `Combo.STRAIGHT`, `Combo.FLUSH`, `Combo.FULL_HOUSE`, `Combo.FOUR_OF_A_KIND`, `Combo.STRAIGHT_FLUSH`.\n\nCombo could be set by cards string\n\n```python\n>>> from thpoker.core import Combo\n\n>>> combo = Combo(cards_string=\"8h/9h/Th/Jh/Qh/Kh/Ah\")\n>>> combo.type\n9\n>>> combo.type == Combo.STRAIGHT_FLUSH\nTrue\n>>> combo.cards\n[A\u2665, K\u2665, Q\u2665, J\u2665, T\u2665]\n>>> combo.name\n'straight flush'\n>>> combo\n[9, A\u2665, K\u2665, Q\u2665, J\u2665, T\u2665]\n>>> print(combo)\nstraight flush (A\u2665, K\u2665, Q\u2665, J\u2665, T\u2665)\n```\n\nAlso combo could be set by cards\n\n```python\n>>> from thpoker.core import Cards, Combo\n\n>>> cards = Cards(\"3d/8c/Kh/8s/3h/Js/8h\")\n>>> combo = Combo(cards=cards)\n>>> print(combo)\nfull house (8\u2663, 8\u2660, 8\u2665, 3\u2666, 3\u2665)\n```\n\nAlso combo could be set by table and hand\n\n```python\n>>> from thpoker.core import Table, Hand, Combo\n\n>>> table = Table(\"Ts/5c/Ac/Kd/5h\")\n>>> hand = Hand(\"Qh/5s\")\n>>> combo = Combo(table=table, hand=hand)\n>>> print(combo)\nthree of a kind (5\u2663, 5\u2665, 5\u2660, A\u2663, K\u2666)\n```\n\n\u0421ombo can be compared\n```python\n>>> from thpoker.core import Combo\n\n>>> combo1 = Combo(cards_string=\"8h/2c/Jd/Jh/5s/Kh/5c\")\n>>> print(combo1)\ntwo pairs (J\u2666, J\u2665, 5\u2660, 5\u2663, K\u2665)\n>>> combo2 = Combo(cards_string=\"9d/As/3c/9h/Qs/9s/9c\")\n>>> print(combo2)\nfour of a kind (9\u2666, 9\u2665, 9\u2660, 9\u2663, A\u2660)\n>>> combo1 > combo2\nFalse\n>>> combo1 < combo2\nTrue\n>>> combo1 != combo2\nTrue\n>>> combo1 == combo2\nFalse\n\n>>> combo3 = Combo(cards_string=\"Qd/6d/9d/Kd/2d/8c/7d\")\n>>> print(combo3)\nflush (K\u2666, Q\u2666, 9\u2666, 7\u2666, 6\u2666)\n>>> combo4 = Combo(cards_string=\"Qd/6d/9d/Kd/2d/6s/6h\")\n>>> print(combo4)\nflush (K\u2666, Q\u2666, 9\u2666, 6\u2666, 2\u2666)\n>>> combo3 > combo4\nTrue\n>>> combo3 < combo4\nFalse\n>>> combo3 != combo4\nTrue\n>>> combo3 == combo4\nFalse\n\n>>> combo5 = Combo(cards_string=\"4s/3c/8d/Kd/8s/8h/3d\")\n>>> print(combo5)\nfull house (8\u2666, 8\u2660, 8\u2665, 3\u2663, 3\u2666)\n>>> combo6 = Combo(cards_string=\"4s/3c/8d/Kd/8s/3s/8c\")\n>>> print(combo6)\nfull house (8\u2666, 8\u2660, 8\u2663, 3\u2663, 3\u2660)\n>>> combo5 > combo6\nFalse\n>>> combo5 < combo6\nFalse\n>>> combo5 != combo6\nFalse\n>>> combo5 == combo6\nTrue\n```\n\nThere is an opportunity to check whether combo base cards include hand cards or not\n\n```python\n>>> from thpoker.core import Table, Hand, Combo\n\n>>> table1 = Table(\"7d/Ts/4d/8c/6h\")\n>>> hand1 = Hand(\"Ad/9c\")\n>>> combo1 = Combo(table=table1, hand=hand1, nominal_check=True)\n>>> print(combo1)\nstraight (T\u2660, 9\u2663, 8\u2663, 7\u2666, 6\u2665)\n>>> combo1.is_real\nTrue\n>>> combo1.is_nominal\nFalse\n>>> # combo base cards are (T\u2660, 9\u2663, 8\u2663, 7\u2666, 6\u2665)\n\n>>> table2 = Table(\"8h/3c/8c/6d/5s\")\n>>> hand2 = Hand(\"Qc/Jc\")\n>>> combo2 = Combo(table=table2, hand=hand2, nominal_check=True)\n>>> print(combo2)\none pair (8\u2665, 8\u2663, Q\u2663, J\u2663, 6\u2666)\n>>> combo2.is_real\nFalse\n>>> combo2.is_nominal\nTrue\n>>> # combo base cards are (8\u2665, 8\u2663)\n```\n\nFull house and two pairs (which combo base cards consist of two parts) can be half nominal\n\n```python\n>>> from thpoker.core import Table, Hand, Combo\n\n>>> table1 = Table(\"Th/6c/5h/Qh/5d\")\n>>> hand1 = Hand(\"Qd/Qs\")\n>>> combo1 = Combo(table=table1, hand=hand1, nominal_check=True)\n>>> print(combo1)\nfull house (Q\u2665, Q\u2660, Q\u2666, 5\u2665, 5\u2666)\n>>> combo1.is_half_nominal\nTrue\n>>> # combo base cards are (Q\u2665, Q\u2660, Q\u2666) and (5\u2665, 5\u2666)\n\n>>> table2 = Table(\"Kd/7s/Th/Ts/Jd\")\n>>> hand2 = Hand(\"2h/Kh\")\n>>> combo2 = Combo(table=table2, hand=hand2, nominal_check=True)\n>>> print(combo2)\ntwo pairs (K\u2666, K\u2665, T\u2665, T\u2660, J\u2666)\n>>> combo1.is_half_nominal\nTrue\n>>> # combo base cards are (K\u2666, K\u2665) and (T\u2665, T\u2660)\n```\n\n### HardCore\n\n*HardCore is the project module that allows you to find a combination faster than Core module, but HardCore is not as friendly as Core is. Since version 1.1.0 hardcore module based on [CTHPoker](https://github.com/YegorDB/CTHPoker) module, wich is based on C.*\n\n#### hcard(sign)\n\nSome card from standard 52 cards deck.\n\nSign is the same as `cards.core.Card` sign from [AGStuff](https://github.com/YegorDB/AGStuff).\n\n```python\n>>> from thpoker.hardcore import hcard\n\n>>> card = hcard(\"5s\")\n>>> card\n54\n```\n\nHardCore card is a number.\n\nWeight numbers: `20` (Two), `30` (Three), `40` (Four), `50` (Five), `60` (Six), `70` (Seven), `80` (Eight), `90` (Nine), `100` (Ten), `110` (Jack), `120` (Queen), `130` (King), `140` or `10` (Ace).\n\nSuit numbers: `1` (clubs), `2` (diamonds), `3` (hearts), `4` (spades).\n\n```python\n>>> from thpoker.hardcore import hcard\n\n>>> card = hcard(\"Qd\")\n>>> isinstance(card, int)\nTrue\n>>> card == 122\nTrue\n```\n\n#### hdeck()\n\nStandard 52 cards deck.\n\n```python\n>>> from thpoker.hardcore import hdeck\n\n>>> deck = hdeck()\n>>> deck\n[\n 21, 22, 23, 24,\n 31, 32, 33, 34,\n 41, 42, 43, 44,\n 51, 52, 53, 54,\n 61, 62, 63, 64,\n 71, 72, 73, 74,\n 81, 82, 83, 84,\n 91, 92, 93, 94,\n 101, 102, 103, 104,\n 111, 112, 113, 114,\n 121, 122, 123, 124,\n 131, 132, 133, 134,\n 141, 142, 143, 144\n]\n\n>>> isinstance(deck, list)\nTrue\n```\n\n#### hcards(cards_string, in_hand=0)\n\nSeveral cards.\n\n```python\n>>> from thpoker.hardcore import hcards\n\n>>> cards = hcards(\"7s/Td/3h/Kd/5c\")\n>>> cards\n[74, 102, 33, 132, 51]\n>>> isinstance(cards, list)\nTrue\n```\n\nCards can be set as player's hand cards\n\n```python\n>>> from thpoker.hardcore import hcards\n\n>>> cards = hcards(\"Js/Qs\", in_hand=1)\n>>> cards\n[1114, 1124]\n>>> # hand cards are more than usual cards in a thousand\n```\n\n#### hcombo(cards_string)\n\nCards combination set by cards string\n\nThere are 9 HardCore combinations: `1` (high card), `2` (one pair), `3` (two pairs), `4` (three of a kind), `5` (straight), `6` (flush), `7` (full house), `8` (four of a kind), `9` (straight flush).\n\n```python\n>>> from thpoker.hardcore import hcombo\n\n>>> combo1 = hcombo(\"Tc/9c/8c/7c/6c\")\n>>> combo1\n[9, 10]\n>>> # 1st number mean it is straight flush\n... # 2nd number mean the highest straight flush card is \"ten\"\n\n>>> combo2 = hcombo(\"4d/Js/4s/8d/4h\")\n>>> combo2\n[4, 4, 11, 8]\n>>> # 1st number mean it is three of a kind\n... # 2nd number mean it is three of \"fours\"\n... # 3nd and 4th numbers mean additional cards (\"jack\" and \"eight\")\n\n>>> combo1 > combo2\nTrue\n>>> combo1 < combo2\nFalse\n>>> combo1 != combo2\nTrue\n>>> combo1 == combo2\nFalse\n```\n\n#### chcombo(cards)\n\nCards combination set by cards\n\n```python\n>>> from thpoker.hardcore import hcards, chcombo\n\n>>> combo1 = chcombo(hcards(\"Qs/2h/9s/6s/Ad\"))\n>>> combo1\n[1, 14, 12, 9, 6, 2]\n>>> # 1st number mean it is high card\n... # other numbers mean combination cards\n\n>>> combo2 = chcombo(hcards(\"Jd/3d/7d/Kd/5d\"))\n>>> combo2\n[6, 13, 11, 7, 5, 3]\n>>> # 1st number mean it is flush\n... # other numbers mean combination cards\n\n>>> combo1 > combo2\nFalse\n>>> combo1 < combo2\nTrue\n>>> combo1 != combo2\nTrue\n>>> combo1 == combo2\nFalse\n```\n\n#### rhcombo(cards)\n\nCards combination set by table and hand. Also shows combination ratio that mean whether combination is real or not\n\n```python\n>>> from thpoker.hardcore import hcards, rhcombo\n\n>>> combo1, ratio1 = rhcombo(table=hcards(\"7d/Js/3d/7c/7h\"), hand=hcards(\"7s/8s\", in_hand=1))\n>>> combo1\n[8, 7, 11]\n>>> ratio1\n2\n>>> # 1st combo number mean it is four of a kind\n... # 2nd combo number mean it is four of a \"seven\"\n... # 3rd combo number mean additional combo card is \"jack\"\n... # ratio mean it is real combo\n\n>>> combo2, ratio2 = rhcombo(table=hcards(\"5h/Qc/8d/Ts/5d\"), hand=hcards(\"Tc/Kh\", in_hand=1))\n>>> combo2\n[3, 10, 5, 13]\n>>> ratio2\n1\n>>> # 1st combo number mean that it is two pairs\n... # 2nd combo number mean that 1st pair is pair of \"ten\"\n... # 3rd combo number mean that 2nd pair is pair of \"five\"\n... # 4th combo number mean that additional combination card is \"king\"\n... # ratio mean it is half nominal combo\n\n>>> combo3, ratio3 = rhcombo(table=hcards(\"Ad/2s/3c/4c/5h\"), hand=hcards(\"Ts/Tc\", in_hand=1))\n>>> combo3\n[5, 5]\n>>> ratio3\n0\n>>> # 1st combo number mean that it is straight\n... # 2nd combo number mean that the highest straight card is \"five\"\n... # ratio mean it is nominal combo\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/YegorDB/THPoker", "keywords": "poker cards", "license": "", "maintainer": "", "maintainer_email": "", "name": "THPoker", "package_url": "https://pypi.org/project/THPoker/", "platform": "", "project_url": "https://pypi.org/project/THPoker/", "project_urls": { "Homepage": "https://github.com/YegorDB/THPoker" }, "release_url": "https://pypi.org/project/THPoker/1.1.0/", "requires_dist": [ "CTHPoker", "AGStuff" ], "requires_python": ">=3.6", "summary": "Texas Hold'em Poker tool", "version": "1.1.0" }, "last_serial": 5482935, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "1a986c767a3db92a2f61859eaecd3e5c", "sha256": "0b1682a5810295a5346ac544d03225b742607950b87fedafc476747dd3b644a5" }, "downloads": -1, "filename": "THPoker-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1a986c767a3db92a2f61859eaecd3e5c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "==3.6", "size": 11449, "upload_time": "2018-04-01T20:17:40", "url": "https://files.pythonhosted.org/packages/11/c6/d6d0214aee0737cb73b9ff14455b5543dd6b02f10203c9527d48602108b6/THPoker-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "41c01460cdedf032e02be15a7f144953", "sha256": "7dbac2470327d69d327d70077defdfa82218db5ecb9c094fa626c69176b60259" }, "downloads": -1, "filename": "THPoker-1.0.0.tar.gz", "has_sig": false, "md5_digest": "41c01460cdedf032e02be15a7f144953", "packagetype": "sdist", "python_version": "source", "requires_python": "==3.6", "size": 15638, "upload_time": "2018-04-01T20:17:41", "url": "https://files.pythonhosted.org/packages/b8/70/89834e50ead4cd2bba46717247f3b8f01d53213db11b171e69970d5c9002/THPoker-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "0d3c43860bfb85b2272aaa8187932104", "sha256": "170f9595b44d84639827720fe4622b9b4ef6defced0b3d9a3fa0b2bb4f15fb7c" }, "downloads": -1, "filename": "THPoker-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0d3c43860bfb85b2272aaa8187932104", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 10566, "upload_time": "2018-05-22T19:04:06", "url": "https://files.pythonhosted.org/packages/65/2b/a18cfad3f6c1461ef77985e2abba075f544b07bc7acbd949b0161460f505/THPoker-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9a4ab8a75c3adffa0eb6290ee94c6f9", "sha256": "6751ced57407260f6abe04abfa58ae0b0ad6c269dea913eb34ae783a981e67e7" }, "downloads": -1, "filename": "THPoker-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c9a4ab8a75c3adffa0eb6290ee94c6f9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 15630, "upload_time": "2018-05-22T19:04:07", "url": "https://files.pythonhosted.org/packages/71/8c/c6fdc6c15c7589f2a6da464cb45684c832cb3972fb2ad865708731b3a4e1/THPoker-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "3ba0121c66aed6276a0afb78a90a51e7", "sha256": "cd64868a73267f1d54bfd2c84076d742b0dbded5bfda074660328c130cb2781b" }, "downloads": -1, "filename": "THPoker-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3ba0121c66aed6276a0afb78a90a51e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 20065, "upload_time": "2019-07-03T18:21:41", "url": "https://files.pythonhosted.org/packages/58/30/b37ef45a0dcef42fd9a5ce10f2b3a3f6b1470711e72e3b82468d2b2bbe2d/THPoker-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f9837282afc1aca77124d643e958a8cd", "sha256": "c0a165ae2c304eb324e63f2640c747ab37f3e8a69d4826e1902691b78d83cc29" }, "downloads": -1, "filename": "THPoker-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f9837282afc1aca77124d643e958a8cd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 14587, "upload_time": "2019-07-03T18:21:43", "url": "https://files.pythonhosted.org/packages/64/f4/e1bf7cdb4d6aebe3404477ea8dd37f6f6c6e89afbb90839fdc730f5de329/THPoker-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3ba0121c66aed6276a0afb78a90a51e7", "sha256": "cd64868a73267f1d54bfd2c84076d742b0dbded5bfda074660328c130cb2781b" }, "downloads": -1, "filename": "THPoker-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3ba0121c66aed6276a0afb78a90a51e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 20065, "upload_time": "2019-07-03T18:21:41", "url": "https://files.pythonhosted.org/packages/58/30/b37ef45a0dcef42fd9a5ce10f2b3a3f6b1470711e72e3b82468d2b2bbe2d/THPoker-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f9837282afc1aca77124d643e958a8cd", "sha256": "c0a165ae2c304eb324e63f2640c747ab37f3e8a69d4826e1902691b78d83cc29" }, "downloads": -1, "filename": "THPoker-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f9837282afc1aca77124d643e958a8cd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 14587, "upload_time": "2019-07-03T18:21:43", "url": "https://files.pythonhosted.org/packages/64/f4/e1bf7cdb4d6aebe3404477ea8dd37f6f6c6e89afbb90839fdc730f5de329/THPoker-1.1.0.tar.gz" } ] }