{ "info": { "author": "Melvyn Petrocchi", "author_email": "w4pity@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved", "Natural Language :: French", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# astar_python\n\nusing:\n\n - from astar_python.astar import Astar\n\nbuild your weight map:\n\n```python\nmat = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n]\n```\nInit the Astar object\n```python\nastar = Astar(mat)\n```\n\nRun astar with a start point and a end point like [x, y] (left to right = x, top to bottom = y \n```python\nresult = astar.run([0, 0], [10, 9])\n```\nresult is an array of point:\n```python\nprint(result)\n--\n[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 9]]\n\n```\nIf no way to the end, A* return None\n\ngive:\n\n```python\n[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]\n[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]\n[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]\n[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]\n```\n\n# Weights\nA weight on the matrix is the cost to cross the point.\n\nCost can be:\n\n* positive: more it is positive, more it's difficult to cross the region\n* negative: is like a booster, you can custom your way\n* 0: a normal point\n* None: not crossable\n\nExemple: The number '1' is the way taken, others are weights\n\n\n\n```python\n# A simple barrage\n[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 0, 1, 0, 0, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]\n\n\n# It decided to cross barrage\n[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 0, 1, 0, 0, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0]\n[0, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0]\n[0, 0, 0, 0, 0, None, 0, 1, 1, 1, 1]\n\nastar_python\n[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n[0, 1, 0, -5, -5, -5, 0, 0, 0, 0, 0]\n[0, 0, 1, 0, 0, 5, 1, 0, 0, 0, 0]\n[0, 0, 0, 0, 0, 5, 0, 1, 0, 0, 0]\n[0, 0, 0, 0, 0, 5, 0, 0, 1, 0, 0]\n[0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 0]\n[0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1]\n[0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1]\n[0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1]\n[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\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/zephirdeadline/astar_python", "keywords": "", "license": "WTFPL", "maintainer": "", "maintainer_email": "", "name": "astar-python", "package_url": "https://pypi.org/project/astar-python/", "platform": "", "project_url": "https://pypi.org/project/astar-python/", "project_urls": { "Homepage": "https://github.com/zephirdeadline/astar_python" }, "release_url": "https://pypi.org/project/astar-python/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "A simple pathfinding eazy to use, A*", "version": "0.1.0" }, "last_serial": 4371974, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8986f67080b65f0883531a54bd7ffc02", "sha256": "a6b3f149b5b7ecb8db2411f778c4ddf2f1ed65423bf754bf0d4db243aed52506" }, "downloads": -1, "filename": "astar_python-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8986f67080b65f0883531a54bd7ffc02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4137, "upload_time": "2018-10-13T13:49:41", "url": "https://files.pythonhosted.org/packages/f0/7a/a6b6b8734ce0b661ec4e0676a9a1f9ffc18d454bca8a8c98cf10f4151e41/astar_python-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8986f67080b65f0883531a54bd7ffc02", "sha256": "a6b3f149b5b7ecb8db2411f778c4ddf2f1ed65423bf754bf0d4db243aed52506" }, "downloads": -1, "filename": "astar_python-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8986f67080b65f0883531a54bd7ffc02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4137, "upload_time": "2018-10-13T13:49:41", "url": "https://files.pythonhosted.org/packages/f0/7a/a6b6b8734ce0b661ec4e0676a9a1f9ffc18d454bca8a8c98cf10f4151e41/astar_python-0.1.0.tar.gz" } ] }