{ "info": { "author": "Felix Wallner", "author_email": "felix.wallner@protonmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "\nStacksplit\n==========\n\nA simple Python library to generate all combinations of possible splits for a stack with given height.\n\n## Introduction\nThis library aims to generate all possible combinations to split a given integer `num` into a given number of parts; the sum of all those parts shall again be the given `num`.\n\nWe wrote this simple library out of lack of such functionality needed in a lecture of our Computer Science BSc-Degree.\nThe original use case was to calculate and solve extended versions of the NIM-game, where towers of coins could also be splitted into multpile smaller towers.\n\n## Usage\nBe sure to have stacksplit installed.\n\nImport stacksplit library:\n```python\nimport stacksplit\n```\n\nThe function provided is **_split_** and is implemented as a Python-generator; it takes 2 (optionally 3) arguments:\n- `num`: the Integer to be split up\n- `parts`: the number of parts\n- `smallest`: the smallest part shall be >= the given parameter. This parameter is **optional** and defaults to 1.\n\n```python\nsplit(num, parts, smallest)\n```\n\nEach call returns a new tuple with a new combination with all elements summing up to `num`.\n\nlook at doc_strings and comments in init and core for help\n\n### Examples\n### Simple usage\n```python\nimport stacksplit\n\nfor s in stacksplit.split(50, 3):\n print(s)\n```\nOutput:\n```\n(1, 1, 48)\n(1, 2, 47)\n...\n```\n### More options\n```python\nfrom stacksplit import split\n\nfor i in split(50, 3, 10):\n print(i)\n```\nOutput:\n```\n(10, 10, 30)\n(10, 11, 29)\n...\n```\n### Extended usecases\n`smallest` can also be 0 or negative. The results will always sum up to `num`.\n```python\nfrom stacksplit import split\n\nfor i in split(5, 3, -1):\n print(i)\n```\nOutput:\n```\n(-1, -1, 7)\n(-1, 0, 6)\n(-1, 1, 5)\n...\n```\n\n## Performance\nThe library uses Python native generators to achieve the fast generation of results; however you have to understand that the problem itself is quite complex and the number of results will increment exponentially with higher values as parameters.\n\nThe following graphs visualize this growth of results.\n\nGraph |Description\n------|-----\n![constant parts, increment num](./docs/xnum_yres_parts4_small.png) | **y-axis**: number of result
**x-axis**: the `num` parameter
`parts`: constant 4\n![constant num, increment parts](./docs/xparts_yres_small.png) | **y-axis**: number of results
**x-axis**: the `parts` parameter
`num`: constant\n\n## Installation\nThis library can be installed via `pip install stacksplit`.\n\n### Arch Linux\nThe AUR package will be named `python-stacksplit`.\n\n## Testing\nTo run the tests for stacksplit:\n\n* install pipenv (https://pypi.org/project/pipenv/)\n* clone this repository\n* in this repository run `pipenv install --dev`\n\nYou may then use these:\n\n* run normal tests: `pipenv run python setup.py test`\n* run tests with coverage: `pipenv run python setup.py test --coverage`\n* run tox tests: `pipenv run tox` (make sure you have interpreters for python - 3.4 to 3.7)\n\n\n_Note:\nIt is possible to use a normal virtual environmet by installing the dev-dependencies from Pipfile by hand with pip. (For exact versions see Pipfile.lock)_\n\n\n## Authors\n* Micheal Oberrauch - bloor.mo@protonmail.com\n* Felix Wallner - felix.wallner@protonmail.com\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://gitlab.com/felixwallner/stacksplit", "keywords": "stack,split,partition,combinations,NIM,Laskers-NIM,gametheorie,coins,sum", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "stacksplit", "package_url": "https://pypi.org/project/stacksplit/", "platform": "", "project_url": "https://pypi.org/project/stacksplit/", "project_urls": { "Homepage": "https://gitlab.com/felixwallner/stacksplit" }, "release_url": "https://pypi.org/project/stacksplit/0.0.0/", "requires_dist": null, "requires_python": ">=3.4.0", "summary": "A simple Python library to generate all combinations of possible splits for a stack with given height.", "version": "0.0.0" }, "last_serial": 4906304, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "789ffb57503f7f068cfd0d1b97027677", "sha256": "e2b268bde1fea699664bb9c2798f7a2faa735d1b43eb3217ad0c1c4bd8b393b9" }, "downloads": -1, "filename": "stacksplit-0.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "789ffb57503f7f068cfd0d1b97027677", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4.0", "size": 5432, "upload_time": "2019-03-06T16:54:20", "url": "https://files.pythonhosted.org/packages/32/e6/73c3d028c545a2bc68386fd8fa94ad897eb4138fdae141dbbd3a93afb8f3/stacksplit-0.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "640ce9bacc9dfd321b6bf2a99da7f833", "sha256": "64eac9383e37e695b07dffec87c0edfae54bd201ab0cdabd00ceb689aa96b5e4" }, "downloads": -1, "filename": "stacksplit-0.0.0.tar.gz", "has_sig": false, "md5_digest": "640ce9bacc9dfd321b6bf2a99da7f833", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4.0", "size": 46016, "upload_time": "2019-03-06T16:54:23", "url": "https://files.pythonhosted.org/packages/d6/c1/93e3beba162d4199f01c37e3328a5a48863fd819fff6bdbdd73b5f8718ff/stacksplit-0.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "789ffb57503f7f068cfd0d1b97027677", "sha256": "e2b268bde1fea699664bb9c2798f7a2faa735d1b43eb3217ad0c1c4bd8b393b9" }, "downloads": -1, "filename": "stacksplit-0.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "789ffb57503f7f068cfd0d1b97027677", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4.0", "size": 5432, "upload_time": "2019-03-06T16:54:20", "url": "https://files.pythonhosted.org/packages/32/e6/73c3d028c545a2bc68386fd8fa94ad897eb4138fdae141dbbd3a93afb8f3/stacksplit-0.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "640ce9bacc9dfd321b6bf2a99da7f833", "sha256": "64eac9383e37e695b07dffec87c0edfae54bd201ab0cdabd00ceb689aa96b5e4" }, "downloads": -1, "filename": "stacksplit-0.0.0.tar.gz", "has_sig": false, "md5_digest": "640ce9bacc9dfd321b6bf2a99da7f833", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4.0", "size": 46016, "upload_time": "2019-03-06T16:54:23", "url": "https://files.pythonhosted.org/packages/d6/c1/93e3beba162d4199f01c37e3328a5a48863fd819fff6bdbdd73b5f8718ff/stacksplit-0.0.0.tar.gz" } ] }