{ "info": { "author": "Ryan Parman", "author_email": "ryan@ryanparman.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: PyPy" ], "description": ".. _demo-of-the-game-of-\"set\":\n\nDemo of the game of \"Set\"\n=========================\n\n|Source| |Downloads| |Release| |Pypi Release| |Open Issues| |Build\nStatus| |Implementation| |Python Versions| |Package Format| |Stability|\n|Coverage Status| |Code Climate| |Code Quality| |License| |Author|\n\n\"Set\" is a card game where a group of players try to identify a *Set* of\ncards from those placed face-up on a table.\n\nThis project uses `Semantic Versioning `__ for\nmanaging backwards-compatibility.\n\n- `API Reference `__\n\nThe Game\n--------\n\nCore Concepts\n~~~~~~~~~~~~~\n\n- Each *Card* has 4 *Properties*: color, shape, shading, and number.\n- The *Deck* is a collection of all of the *Cards*.\n- The *Board* is a subset of the *Deck*, containing only the cards that\n are currently in-play.\n- A *Set* is a collection of 3 cards which meet certain criteria\n (discussed below). When a *Set* is found in-play on the *Board*, the\n *Set* is removed from play and logged as such.\n- The *Game* encapsulates all of these concepts and keeps track of\n them.\n\nGame Rules\n~~~~~~~~~~\n\nEach *Card* has an image on it with 4 orthogonal attributes:\n\n- Color (red, green, or purple)\n- Shape (diamond, squiggle, or oval)\n- Shading (solid, empty, or striped)\n- Number (one, two, or three)\n\nThree *Cards* are a part of a *Set* if, for each *Property*, the values\nare all the same or all different.\n\nFor example:\n\n- The *Cards* \"two red solid squiggles\", \"one green solid diamond\",\n \"three purple solid ovals\" would make up a *Set*. (number, shape, and\n color are different, shading is the same)\n- The *Cards* \"two red solid squiggles\", \"one green solid squiggles\",\n \"three purple solid ovals\" would not make up a *Set*, because shape\n is the same on two *Cards*, but different on the third.\n- A *Game* of \"Set\" starts by dealing 12 *Cards*, face-up. When a\n player sees three *Cards* that make up a *Set*, they yell \"Set!\" and\n grab the *Cards*. New *Cards* are dealt from the *Deck* to replace\n them.\n- If no player can find a *Set*, three more *Cards* are dealt (to make\n 15, then 18, then 21...)\n- The *Game* is over when there are no *Cards* left in the *Deck*, and\n no *Sets* left on the table. The player with the most *Sets* wins.\n\nGame Requirements\n~~~~~~~~~~~~~~~~~\n\nYour task is to model the *Game* in code, and implement the following\nmethods:\n\n- A method that takes three *Cards*, and determines whether the three\n *Cards* make a *Set*.\n- A method that given a *Board* of *Cards*, will either find a *Set*,\n or determine that there are no *Sets* on the table.\n- A method that will play an entire *Game* of \"Set\", from beginning to\n end, and return a list of each valid *Sets* you removed from the\n *Board*.\n\nFor this last method, there will be multiple correct solutions, but any\nvalid list of *Sets* is fine.\n\nAssumptions\n~~~~~~~~~~~\n\n *\u201cThree cards are a part of a set if, for each property, the values\n are all the same or all different.\u201d*\n\nThis is phrased ambiguously, and the examples given lead me to believe\nthat the following is a more specific description of the rules.\n\n- Take 3 cards and look at each of their properties one-by-one.\n- If all cards have a different value for that property OR all cards\n have the same value for that property, then it *may* be a set.\n- If *any* properties of step 2 fail the test, then the group is not a\n set.\n\nProblem Parameters\n~~~~~~~~~~~~~~~~~~\n\n- This problem uses mathematical *combinations* (as opposed to\n *permutations*). This results in 81 combinations (``3^4``).\n- Any failure of being a *Set* means that the group is not a set, so\n fail as early as possible and move-on.\n\nLogic\n~~~~~\n\n(Whereas \u201c\\ *Combination*\\ \u201d refers to the `mathematical\nconcept `__.)\n\n1. Create the deck of available cards by ensuring that every card is\n unique, and that all *Combinations* of properties are represented.\n Also, shuffle the deck by default.\n2. Deal 12 cards to the *Board*.\n3. Calculate all possible *Combinations* of the cards on the *Board*, in\n groups of 3.\n4. Iterate over each *Combination*, applying logic to determine whether\n or not this *Combination* represents a *Set*.\n5. Collect the *Sets* by removing the *Cards* which are determined to be\n part of a *Set*.\n6. When no more *Sets* can be found, deal another 3 *Cards* from the\n *Deck*.\n7. Repeat steps 3\u20136 until the *Deck* is empty.\n\nRequirements\n------------\n\n- Python 2.7, 3.3+, Pypy\n- Pip\n- VirtualEnv is recommended, but not required\n\nInstallation\n------------\n\n.. code:: bash\n\n # Install from Pypi\n pip install skyzyx-set-game-demo\n\n # Install from local code\n pip install -e .\n\nAnd either include it in your scripts:\n\n.. code:: python\n\n from set_game_demo import SetGame\n\n\u2026or run it from the command line.\n\n.. code:: bash\n\n # Application help\n set-game-demo -h\n\n.. _usage/examples:\n\nUsage/Examples\n--------------\n\nFrom the Python REPL or a Python script\u2026\n\n.. code:: python\n\n from __future__ import print_function\n from set_game_demo import SetGame\n\n # Initialize the game.\n game = SetGame()\n\n # Chatty, interactive version of the game.\n game.play()\n\n # Quiet version of the game. Good for code.\n discovered, sets = game.play_quiet()\n print(\"Sets discovered: {}\".format(discovered))\n for set in sets:\n game.display_cards(set)\n\nFrom the Terminal\u2026\n\n.. code:: bash\n\n # Chatty, interactive version of the game.\n set-game-demo\n\n # Quiet version of the game.\n set-game-demo --quiet\n\nKnown Issues\n------------\n\n- In a final release, it would be wise to update the\n ``requirements.txt`` to allow for ranges of known-good versions\n instead of locking to one specific version.\n\n - Conversely, if this is the sole project running in this virtual\n environment, locking to a specific known-good version ensures\n fewer version-compatibility issues.\n\nFuture Improvements\n-------------------\n\n- Update the ``test_deal`` unit test to verify that we do not attempt\n to deal a larger number of cards than the deck contains (couldn't\n quite figure out the right way to call ``assertRaises()`` from the\n ``unittest`` package through the ``nose2`` interface).\n- Support multiple *Players* who can collect sets and compete for\n scores.\n\nDevelopment\n-----------\n\n- You can develop in any supported version of Python.\n\n- Using `pyenv `__ to manage your\n Pythons is *highly-recommended*. Testing locally **depends** on it.\n\n- Install `VirtualEnv `__ for\n your development environment, and *activate* the environment.\n\n .. code:: bash\n\n pip install virtualenv\n virtualenv .vendor\n source .vendor/bin/activate\n\n- Install the ``requirements.txt``.\n\n .. code:: bash\n\n pip install -r requirements.txt\n\n- When you make changes, make sure that you run the linter and fix\n anything that's broken.\n\n .. code:: bash\n\n make lint\n\nTesting\n-------\n\nWe use `tox `__ to handle local testing\nacross multiple versions of Python. We install multiple versions of\nPython at a time with `pyenv `__.\n\nTesting occurs against the following versions:\n\n- Python 2.7\n- Python 3.3\n- Python 3.4\n- Python 3.5\n- Python 3.6\n- Python 3.7\n- Pypy\n- Pypy3\n\nTo begin\u2026\n\n1. Install `pyenv `__ on your own before\n running tests.\n\n2. You need to install all of the supported versions of Python. (This\n will take a while.) If you would prefer to install your own copies of\n the supported Python versions (listed above), feel free to manage\n them yourself.\n\n .. code:: bash\n\n pyenv install 3.7.1 && \\\n pyenv install 3.6.7 && \\\n pyenv install 3.5.6 && \\\n pyenv install 3.4.9 && \\\n pyenv install 3.3.7 && \\\n pyenv install 2.7.15 && \\\n pyenv install pypy-5.7.1 && \\\n pyenv install pypy3.5-6.0.0 && \\\n pyenv rehash && \\\n eval \"$(pyenv init -)\" && \\\n pyenv global system 2.7.15 3.3.7 3.4.9 3.5.6 3.6.7 3.7.1 pypy-5.7.1 pypy3.5-6.0.0\n\n To verify that the installation and configuration were successful,\n you can run ``pyenv versions``. You should see a ``*`` character in\n front of every version that we just installed.\n\n .. code:: bash\n\n $ pyenv versions\n * system (set by ~/.pyenv/version)\n * 2.7.12 (set by ~/.pyenv/version)\n * 3.3.6 (set by ~/.pyenv/version)\n * 3.4.5 (set by ~/.pyenv/version)\n * 3.5.2 (set by ~/.pyenv/version)\n * 3.6.0b1 (set by ~/.pyenv/version)\n * pypy-5.3.1 (set by ~/.pyenv/version)\n * pypy3-2.4.0 (set by ~/.pyenv/version)\n\n3. The following command will package-up your module and install it\n locally, then run ``nose2`` to execute the tests in the *default\n system Python*.\n\n .. code:: bash\n\n make test\n\n4. After you've run that, you can then execute the tests in all\n supported versions of Python with the following:\n\n .. code:: bash\n\n tox\n\nAPI Reference\n-------------\n\nBuilding local docs\n~~~~~~~~~~~~~~~~~~~\n\n.. code:: bash\n\n make docs\n open docs/set_game_demo/index.html\n\nBuilding and pushing docs\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: bash\n\n make pushdocs\n\nDocs can be viewed at\n`https://skyzyx.github.io/set-game-demo/ `__.\n\nDeploying\n---------\n\n1. The ``Makefile`` (yes, ``Makefile``) has a series of commands to\n simplify the development and deployment process.\n2. Also install `Chag `__. This is\n used for managing the ``CHANGELOG`` and annotating the Git release\n correctly.\n\nUpdating the CHANGELOG\n~~~~~~~~~~~~~~~~~~~~~~\n\nMake sure that the ``CHANGELOG.md`` is human-friendly. See\n`http://keepachangelog.com `__ if you don\u2019t\nknow how.\n\n``make``\n~~~~~~~~\n\nRunning ``make`` by itself will show you a list of available\nsub-commands.\n\n.. code:: bash\n\n $ make\n all\n buildpip\n clean\n docs\n lint\n pushdocs\n pushpip\n readme\n tag\n test\n version\n\n``make readme``\n~~~~~~~~~~~~~~~\n\nIf you make changes to ``README.md``, then this will use\n`Pandoc `__ to output a ``README.rst`` file in the\n`reStructuredText `__ format\nused by\n`distutils `__,\n`Sphinx `__ and most of the Python community.\n\nYou must have `Pandoc `__ installed on your local\nsystem.\n\n **NOTE:** Initial install via ``brew install pandoc`` takes about\n 8\u201310 hours. Updates are much faster. `Using the\n installer `__ is **much**\n faster for initial installation, but updates are entirely manual.\n\n``make version``\n~~~~~~~~~~~~~~~~\n\nSets the version number that will be used by other ``make`` tasks\nrelated to packaging and bundling.\n\n``make tag``\n~~~~~~~~~~~~\n\nThis will make sure that the ``CHANGELOG.md`` is properly datestamped,\nadd the CHANGELOG contents to the Git commit message, commit them, then\ncreate a Git commit which can be pushed upstream.\n\n``make buildpip``\n~~~~~~~~~~~~~~~~~\n\nThis will bundle-up your package in preparation for uploading to\n`Pypi `__.\n\n``make pushpip``\n~~~~~~~~~~~~~~~~\n\nThis will take your bundled package and upload it securely to\n`Pypi `__ using the ``twine`` package.\n\nDrafting a GitHub release\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n1. Go to\n `https://github.com/skyzyx/set-game-demo/tags `__\n2. Find the new tag that you just pushed. Click the ellipsis (``\u2026``) to\n see the commit notes. Copy these.\n3. To the right, choose *Add release notes*. Your *Tag version* should\n be pre-filled.\n4. The *Release title* should match your *Tag version*.\n5. Inside *Describe this release*, paste the notes that you copied on\n the previous page.\n6. Choose *Publish release*.\n7. Your release should now be the latest.\n `https://github.com/skyzyx/set-game-demo/releases/latest `__\n\nContributing\n------------\n\nHere's the process for contributing:\n\n1. Fork this project to your GitHub account.\n2. Clone your GitHub copy of the repository into your local workspace.\n3. Write code, fix bugs, and add tests with 100% code coverage.\n4. Commit your changes to your local workspace and push them up to your\n GitHub copy.\n5. You submit a GitHub pull request with a description of what the\n change is.\n6. The contribution is reviewed. Maybe there will be some banter\n back-and-forth in the comments.\n7. If all goes well, your pull request will be accepted and your changes\n are merged in.\n\n.. _authors,-copyright-&-licensing:\n\nAuthors, Copyright & Licensing\n------------------------------\n\n- Copyright (c) 2016 `Ryan Parman `__\n\nSee also the list of\n`contributors `__\nwho participated in this project.\n\nLicensed for use under the terms of the `Apache\n2.0 `__ license.\n\n.. |Source| image:: https://img.shields.io/badge/source-skyzyx/set\u2013game\u2013demo-blue.svg?style=flat-square\n :target: https://github.com/skyzyx/set-game-demo\n.. |Downloads| image:: https://img.shields.io/pypi/dm/skyzyx-set-game-demo.svg?style=flat-square\n :target: https://github.com/skyzyx/set-game-demo/releases\n.. |Release| image:: https://img.shields.io/github/release/skyzyx/set-game-demo.svg?style=flat-square\n :target: https://github.com/skyzyx/set-game-demo/releases\n.. |Pypi Release| image:: https://img.shields.io/pypi/v/skyzyx-set-game-demo.svg?style=flat-square\n :target: https://pypi.python.org/pypi/skyzyx-set-game-demo\n.. |Open Issues| image:: http://img.shields.io/github/issues/skyzyx/set-game-demo.svg?style=flat-square\n :target: https://github.com/skyzyx/set-game-demo/issues\n.. |Build Status| image:: http://img.shields.io/travis/skyzyx/set-game-demo/master.svg?style=flat-square\n :target: https://travis-ci.org/skyzyx/set-game-demo\n.. |Implementation| image:: https://img.shields.io/pypi/implementation/skyzyx-set-game-demo.svg?style=flat-square\n :target: https://python.org\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/skyzyx-set-game-demo.svg?style=flat-square\n :target: https://python.org\n.. |Package Format| image:: https://img.shields.io/pypi/format/skyzyx-set-game-demo.svg?style=flat-square\n :target: http://pythonwheels.com\n.. |Stability| image:: https://img.shields.io/pypi/status/skyzyx-set-game-demo.svg?style=flat-square\n :target: https://pypi.python.org/pypi/skyzyx-set-game-demo\n.. |Coverage Status| image:: http://img.shields.io/coveralls/skyzyx/set-game-demo/master.svg?style=flat-square\n :target: https://coveralls.io/r/skyzyx/set-game-demo?branch=master\n.. |Code Climate| image:: http://img.shields.io/codeclimate/github/skyzyx/set-game-demo.svg?style=flat-square\n :target: https://codeclimate.com/github/skyzyx/set-game-demo\n.. |Code Quality| image:: http://img.shields.io/scrutinizer/g/skyzyx/set-game-demo.svg?style=flat-square\n :target: https://scrutinizer-ci.com/g/skyzyx/set-game-demo\n.. |License| image:: https://img.shields.io/github/license/skyzyx/set-game-demo.svg?style=flat-square\n :target: https://github.com/skyzyx/set-game-demo/blob/master/LICENSE.md\n.. |Author| image:: http://img.shields.io/badge/author-@skyzyx-blue.svg?style=flat-square\n :target: https://github.com/skyzyx\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/skyzyx/set-game-demo", "keywords": "set demo game", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "skyzyx-set-game-demo", "package_url": "https://pypi.org/project/skyzyx-set-game-demo/", "platform": "", "project_url": "https://pypi.org/project/skyzyx-set-game-demo/", "project_urls": { "Homepage": "https://github.com/skyzyx/set-game-demo" }, "release_url": "https://pypi.org/project/skyzyx-set-game-demo/1.0.1/", "requires_dist": [ "autoflake (<1.0,>=0.6.6)", "autopep8 (<2.0,>=1.2.4)", "prettytable (<1.0,>=0.7.2)", "pylint (<2.0,>=1.6.4)", "six (<2.0,>=1.10.0)" ], "requires_python": "", "summary": "Simple demo of the game of Set.", "version": "1.0.1" }, "last_serial": 4514274, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "141c7ec5a657e1c05e39dabdba87ea1e", "sha256": "a7dede805c0597e38f898e63e633d19451ad3ddb110d1ad8e617a3f38388ce45" }, "downloads": -1, "filename": "skyzyx_set_game_demo-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "141c7ec5a657e1c05e39dabdba87ea1e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17761, "upload_time": "2016-09-26T08:46:28", "url": "https://files.pythonhosted.org/packages/5f/c5/b639b11189ab4c393d86c6cc20b0e3553b1079f75181c685a48da01f4439/skyzyx_set_game_demo-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1cfef1575c7506cf13a6d61daea4bcd7", "sha256": "b94ddd1928275d4755d86007e207966fa7d754f5c4bfee5acd27e709ab4bed07" }, "downloads": -1, "filename": "skyzyx-set-game-demo-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1cfef1575c7506cf13a6d61daea4bcd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20859, "upload_time": "2016-09-26T08:46:30", "url": "https://files.pythonhosted.org/packages/49/11/d94ec82dae2f7bcc2c481ba85b0232d37704bfefd8bdfc2f0c7b7c53c14f/skyzyx-set-game-demo-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "7bc33786e264df7970071126b7cc7f1a", "sha256": "12b248a804d4410992633bb4baf7aed68d7cb8ffd1a23330db6e268b21609bf8" }, "downloads": -1, "filename": "skyzyx_set_game_demo-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7bc33786e264df7970071126b7cc7f1a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14953, "upload_time": "2018-11-21T21:09:29", "url": "https://files.pythonhosted.org/packages/af/af/a01862be49fcad875db4b87d377eb7e3f78aab4671331699eb3b075987c9/skyzyx_set_game_demo-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ea0605c5dbc58f6860ae524c0cc3dad2", "sha256": "3c5aa823a9b9a72904608a744239838731be9ddae8d8271106685591aa3e614b" }, "downloads": -1, "filename": "skyzyx-set-game-demo-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ea0605c5dbc58f6860ae524c0cc3dad2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25028, "upload_time": "2018-11-21T21:09:31", "url": "https://files.pythonhosted.org/packages/3e/21/a281beb149ff5c6d19487370dc17caac8f13605d46b9ea1a9ab69fb2ab79/skyzyx-set-game-demo-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7bc33786e264df7970071126b7cc7f1a", "sha256": "12b248a804d4410992633bb4baf7aed68d7cb8ffd1a23330db6e268b21609bf8" }, "downloads": -1, "filename": "skyzyx_set_game_demo-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7bc33786e264df7970071126b7cc7f1a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14953, "upload_time": "2018-11-21T21:09:29", "url": "https://files.pythonhosted.org/packages/af/af/a01862be49fcad875db4b87d377eb7e3f78aab4671331699eb3b075987c9/skyzyx_set_game_demo-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ea0605c5dbc58f6860ae524c0cc3dad2", "sha256": "3c5aa823a9b9a72904608a744239838731be9ddae8d8271106685591aa3e614b" }, "downloads": -1, "filename": "skyzyx-set-game-demo-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ea0605c5dbc58f6860ae524c0cc3dad2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25028, "upload_time": "2018-11-21T21:09:31", "url": "https://files.pythonhosted.org/packages/3e/21/a281beb149ff5c6d19487370dc17caac8f13605d46b9ea1a9ab69fb2ab79/skyzyx-set-game-demo-1.0.1.tar.gz" } ] }