{ "info": { "author": "Thomas Breydo", "author_email": "tbreydo@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7", "Topic :: Games/Entertainment :: Board Games", "Topic :: Games/Entertainment :: Turn Based Strategy" ], "description": "# pymastermind\n## Description\nA Python package designed to **play**, **develop** strategies/algorithms, and **implement** the classic [MasterMind](https://en.wikipedia.org/wiki/Mastermind_(board_game)) board game. It even includes a functioning, text-based implementation of MasterMind!\n\n## Installation\nThe source code for **pymastermind** is hosted on [GitHub](https://github.com/thomasbreydo/pymastermind). You can install matermind through PyPI, with pip:\n```zsh\npip install pymastermind\n```\n### Requirements\n**pymastermind** requires the following libraries:\n\n- [pandas](https://github.com/pandas-dev/pandas), used by the _SelfGame_ object\n- [tqdm](https://github.com/tqdm/tqdm), used to display progress bars when finding next guess. _Note: only some algorithms support progress bars. See \"Algorithms\" below._\n\n## Documentation\nRead the full documentation for **pymastermind** [here](https://pymastermind.readthedocs.io).\n\n## Example Usage\n### Play\nPlay a game against your computer, or have your computer play itself, by running `main()` and following text-based instructions.\n```python3\n>>> main() # initiate the game; print instructions & wait for inputs\n```\n### Classes\nSeveral useful classes are defined in the **pymastermind** module.\n#### Code\nCode objects are list instances designed to store a MasterMind codes. You can compare two codes by using the `.compare()` method. [_What's comparing?_](https://en.wikipedia.org/wiki/Mastermind_(board_game)#Gameplay_and_rules)\n```python3\n>>> secret_code = Code(['a', 'b', 'c', 'd'])\n>>> guess = Code(['b', 'c', 'j', 'd'])\n>>> len(secret_code) == len(guess)\nTrue\n>>> secret_code.compare(guess)\n(1, 2)\n```\n_Note: code objects must be of the same length to comapre._\n#### Game\nGame objects are used to immitate gameplay.\n```python3\n>>> my_game = Game() # default: slots == 4, colors == ['a', 'b', 'c', 'd', 'e', 'f']\n>>> secret_code = Code(['e', 'a', 'f', 'f'])\n>>> my_game.guess # always the same for given setup; see Wikipedia article\n['a', 'a', 'b', 'b']\n>>> blacks_and_whites = secret_code.compare(my_game.guess)\n>>> blacks_and_whites\n(1, 0)\n>>> my_game.new_guess(response, algorithm='minmax') # new guess using minmax algorithm (see below)\n>>> my_game.guess\n['a', 'c', 'c', 'd']\n>>> my_game.back() # go back one turn\n>>> my_game.guess\n['a', 'a', 'b', 'b']\n```\nRead the [documentation](https://pymastermind.readthedocs.io/documentation) for an in-depth look at all the attributes and methods of a `Game`.\n##### Algorithms\nA new guess can be generated using several different algorithms. Currently, **pymastermind** has two algorithms implemented:\n\n- _random (default algorithm)_\n - Set the guess to a random secret code possibility\n - No progress bar support yet\n- _minmax_\n - Set the guess to the guess that has the highest min-max score of _all_ guesses. Read more [here](https://en.wikipedia.org/wiki/Mastermind_(board_game)#Five-guess_algorithm).\n - Supports progress bars\n\nSee the full documentation for a more detailed description of the algorithms.\n#### SelfGame\nSelfGame is a subclass of Game that is used to \"play\" games with specified algorithms and obtain a pandas [DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html) full of information about the games played.\n```python3\n>>> my_self_game = SelfGame() # same defaults, so slots == 4, colors == ['a', 'b', 'c', 'd', 'e', 'f']\n>>> df = my_self_game.play() # default: games == 10, algorithm == 'random'\n>>> type(df)\n\n>>> df.loc['Game 3', 'Turn 2'] # example query\nTime 0 days 00:00:00.000610\nStart Possibilities 23\nEnd Possibilities 4\nName: Game 3, dtype: object\n```\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/thomasbreydo/pymastermind/archive/v1.2.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/thomasbreydo/pymastermind", "keywords": "GAME,MASTER,MIND,STRATEGY,BOARD,CODE", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pymastermind", "package_url": "https://pypi.org/project/pymastermind/", "platform": "", "project_url": "https://pypi.org/project/pymastermind/", "project_urls": { "Download": "https://github.com/thomasbreydo/pymastermind/archive/v1.2.tar.gz", "Homepage": "https://github.com/thomasbreydo/pymastermind" }, "release_url": "https://pypi.org/project/pymastermind/1.2/", "requires_dist": null, "requires_python": "", "summary": "A Python package designed to play, develop strategies/algorithms, and implement the classic MasterMind board game.", "version": "1.2" }, "last_serial": 5797282, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "51dc33321c39a491036a873649a29562", "sha256": "fd41f9b6258e19e33d82aeb0d0baa298e5869c11b87aae6b3b1b3581612a0b0e" }, "downloads": -1, "filename": "pymastermind-1.0.tar.gz", "has_sig": false, "md5_digest": "51dc33321c39a491036a873649a29562", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7459, "upload_time": "2019-09-05T01:02:41", "url": "https://files.pythonhosted.org/packages/26/fb/544a43d6918cdb07ca42c40f01cf1903de1b3ed7f79c272163549f8b5b94/pymastermind-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "b67040eaec98c51d811179c5e8ea385b", "sha256": "36657833a0569aadffff07e02ff399ea3539ab110cefbe890a2e8ff5a12659e0" }, "downloads": -1, "filename": "pymastermind-1.1.tar.gz", "has_sig": false, "md5_digest": "b67040eaec98c51d811179c5e8ea385b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8241, "upload_time": "2019-09-07T01:15:01", "url": "https://files.pythonhosted.org/packages/e0/9b/559ad1d6471ab5f63615c8db5a9b07e1fde414782a6227a9a867c30337a6/pymastermind-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "b77c95ecf440fc208cb72f36051c62da", "sha256": "4055b4b4d8c796138bcefb76883099b5285bc0d1beccf005fba2afa849069197" }, "downloads": -1, "filename": "pymastermind-1.2.tar.gz", "has_sig": false, "md5_digest": "b77c95ecf440fc208cb72f36051c62da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10828, "upload_time": "2019-09-07T20:12:18", "url": "https://files.pythonhosted.org/packages/ad/6f/4ac3be7be642e6c19fa3fddf56469afe7e5af149dbabc42672f9260f28d1/pymastermind-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b77c95ecf440fc208cb72f36051c62da", "sha256": "4055b4b4d8c796138bcefb76883099b5285bc0d1beccf005fba2afa849069197" }, "downloads": -1, "filename": "pymastermind-1.2.tar.gz", "has_sig": false, "md5_digest": "b77c95ecf440fc208cb72f36051c62da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10828, "upload_time": "2019-09-07T20:12:18", "url": "https://files.pythonhosted.org/packages/ad/6f/4ac3be7be642e6c19fa3fddf56469afe7e5af149dbabc42672f9260f28d1/pymastermind-1.2.tar.gz" } ] }