{ "info": { "author": "Anderson Frailey", "author_email": "andersonfrailey@gmail.org", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Blackjack\n\n`py21` is a blackjack simulator. Users can run the simulation using the\ndefault rules or specify their own. Additionally, users can test their own\nplaying and betting strategies.\n\n## Installation\n\nRight now `py21` can be installed from source or PyPI.\n\nTo download from source, clone or download this\nrepository, then navigate to the directory you cloned to and run\n`pip install -e .`.\n\nTo download from PyPI, use `pip install py21`\n\n## Using `py21`\n\nTo run the simulator, the user must initiate one instance of the `Game` class\nand at least one instance of the `Player` class.\n\nThe `Player` class requires one input, `bankroll`, and has three optional inputs:\n`strategy_func`, `wager_func`, and `insurance_func`.\n\n`bankroll` should be an numerical value indicating the bankroll\nthe player will be starting with.\n\n`strategy_func` should be a function that will\nreturn what action the player will take in a given situation. This function\ncan take as inputs a number of variables containing information about the game\nsuch as the player's hand, dealer's up card, and the count. It must return one\nof the following: `HIT`, `STAND`, `SPLIT`, `DOUBLE`.\n\n`wager_func` should be a function that will determine how much the player will\nwager in a hand. Like the function used for `strategy_func` it can take as\narguments variables on the status of the game. It must return a number that is\nwithin the minimum and maximum bets allowed, and no more than the player's\nbankroll.\n\n`insurance_func` should be a function that will determine if a player takes\ninsurance when the dealer is showing an ace. It must return `True` or `False`.\n\nThe `Game` class has one required argument and two optional ones. `players`\nis a list of instances of the `Players` class that will be used in the game.\n`rules` can be a dictionary containing changes to the game's default rules to\nrun the simulation under different scenarios. An explanation of how the\ndictionary should be structured is below. Finally, `verbose` is a boolean\nindicator for whether or not you want information printed out as the game is\nplayed.\n\nRunning a simulation can be done in a few lines of code:\n\n```python\nfrom py21 import Game, Player\n\n# initiate Player object\nplayer = Player(100)\n# initiate Game object\ngame = Game([player])\n\n# run simulation 1,000,000 times\ngame.simulate(1000000)\n```\n\n## Updating Game Parameters\n\nTo update a rule in the game, use this dictionary format:\n\n`{param: new_rule}`\n\nFor example, here is how to change the blackjack payout from 3:2 to 6:5:\n\n```python\nfrom py21 import Game, Player\n\nrules = {\"blackjack_payout\": 1.2}\n\nplayer = Player(100)\ngame = Game([player], rules)\n\ngame.simulate(1000000)\n```\n\n### Parameters currently available to be modified:\n\n#### `soft_stand`\n\nWhether or not the dealer must stand on a soft total.\n\nDefault value: True\n\nPossible values: True, False\n\n#### `stand_total`\n\nHand value the dealer must reach before they can stand.\n\nDefault value: 17\n\nPossible values: 4-21\n\n#### `double_after_split`\n\nWhether or not a player can double down after splitting a pair.\n\nDefault value: True\n\nPossible values: True, False\n\n#### `payout`\n\nPayout for a winning hand.\n\nDefault value: 1 (1:1)\n\nPossible values: 0-9e99\n\n#### `blackjack_payout`\n\nTotal payout if the player has blackjack.\n\nDefault value: 1.5 (3/2)\n\nPossible values: 0-9e99 (infinity)\n\n#### `shuffle_freq`\n\nHow often the deck is shuffled. If this value is greater than one, the deck\nwill be shuffled after that many hands are played. If it is less than one, the\ndeck will be shuffled when that percentage of the deck is left.\n\nDefault value: 4\n\nPossible values: 0-9e99 (note: if the shuffle frequency is too low, an\nerror will be raised when the deck runs out of cards)\n\n#### `min_bet`\n\nMinimum bet required.\n\nDefault value: 5\n\nPossible Values: 0-`max_bet\n\n#### `max_bet`\n\nMaximum bet allowed.\n\nDefault value: 500\n\nPossible values: `min_bet`-9e99\n\n#### `max_players`\n\nMaximum number of players allowed in a game.\n\nDefault value: 10\n\nPossible values: 1-9e99\n\n#### `insurance_allowed`\n\nWhether or not a player is allowed to take insurance when the dealer shoes an ace.\n\nDefault value: True\n\nPossible values: True, False\n\n#### `insurance_pct`\n\nWhat share of a player's original bet they must pay to purchase insurance.\n\nDefault value: 0.5\n\nPossible values: 0-1\n\n#### `insurance_payout`\n\nIf the player purchases insurance and the dealer has blackjack, the player will\nreceive this decimal percent of their bet back.\n\nDefault value: 1\n\nPossible values: 0-9e99\n\n#### `surrender_allowed`\n\nWhether or not the player is allowed to surrender a hand.\n\nDefault value: True\n\nPossible values: True, False\n\nNOTE: This parameter has not be implemented yet, therefore changing it will have\n no impact on game play\n\n#### `num_decks`\n\nThe number of decks the game will be played with\n\nDefault value: 8\n\nPossible values: 1-9e99\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/andersonfrailey/blackjack", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "py21", "package_url": "https://pypi.org/project/py21/", "platform": "", "project_url": "https://pypi.org/project/py21/", "project_urls": { "Homepage": "https://github.com/andersonfrailey/blackjack" }, "release_url": "https://pypi.org/project/py21/1.1.0/", "requires_dist": [ "tqdm", "paramtools", "pandas" ], "requires_python": "", "summary": "Library for running blackjack simulations", "version": "1.1.0" }, "last_serial": 5407613, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "eae2ddd16520e77643af2b8c065ab18b", "sha256": "660584433dbf6689d465e8a4049a1f2f76dfefad1400ea0f6dfbf08f5695210e" }, "downloads": -1, "filename": "py21-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "eae2ddd16520e77643af2b8c065ab18b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17134, "upload_time": "2019-05-12T18:18:04", "url": "https://files.pythonhosted.org/packages/1b/24/704266adde1704dbfe25628cb879f8924bb9de3ffe366250803f7f7742c9/py21-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6e65847f655593796bd2d96834b2432", "sha256": "c008a4233982fb0178e60707ffa9c0705c4525db2a1d2ee33d09c295e147925e" }, "downloads": -1, "filename": "py21-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c6e65847f655593796bd2d96834b2432", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14536, "upload_time": "2019-05-12T18:18:07", "url": "https://files.pythonhosted.org/packages/72/bd/f78b4e03b80e958ba15c3d8b99f0eb13df9b87e29d07db99060e6926c10b/py21-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "79ed26d52dc4b3623595bcfaefd85a45", "sha256": "5140f0133e9d2e0aa8bd19398d5f3c673211e97c4c78acdee5264e0d6e3e045b" }, "downloads": -1, "filename": "py21-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "79ed26d52dc4b3623595bcfaefd85a45", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17979, "upload_time": "2019-06-16T21:30:38", "url": "https://files.pythonhosted.org/packages/c0/db/8a3d15503c7643236053d97a2947514e3469b29f9935ee5a98b71d401f76/py21-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4f710491c78e12b079d792ef009a70a5", "sha256": "dba3a2c251d1bd4b633aa0afdf86c7dfeca9046dd92f9dcbd0733e4d7742e7e0" }, "downloads": -1, "filename": "py21-1.1.0.tar.gz", "has_sig": false, "md5_digest": "4f710491c78e12b079d792ef009a70a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15653, "upload_time": "2019-06-16T21:30:41", "url": "https://files.pythonhosted.org/packages/71/c1/8964001b4e57bb9f363b4fb428f08693635b88bc1dc3897f461f64443c99/py21-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "79ed26d52dc4b3623595bcfaefd85a45", "sha256": "5140f0133e9d2e0aa8bd19398d5f3c673211e97c4c78acdee5264e0d6e3e045b" }, "downloads": -1, "filename": "py21-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "79ed26d52dc4b3623595bcfaefd85a45", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17979, "upload_time": "2019-06-16T21:30:38", "url": "https://files.pythonhosted.org/packages/c0/db/8a3d15503c7643236053d97a2947514e3469b29f9935ee5a98b71d401f76/py21-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4f710491c78e12b079d792ef009a70a5", "sha256": "dba3a2c251d1bd4b633aa0afdf86c7dfeca9046dd92f9dcbd0733e4d7742e7e0" }, "downloads": -1, "filename": "py21-1.1.0.tar.gz", "has_sig": false, "md5_digest": "4f710491c78e12b079d792ef009a70a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15653, "upload_time": "2019-06-16T21:30:41", "url": "https://files.pythonhosted.org/packages/71/c1/8964001b4e57bb9f363b4fb428f08693635b88bc1dc3897f461f64443c99/py21-1.1.0.tar.gz" } ] }