python-astar
Yet another A* path search algorithm.
This is one more A star implementation done for fun and I hope someone might find this useful.
You can import this module and use it to find the shortest path in a map given by a matrix.
There also a procedural implementation in the examples/basic.py file that will probably be more easy to read and didactic in case you are learning how A* works.
install:
pip install python-astar
usage:
from astar.search import AStar
# Make a map (any size!)
world = [
[0,0,0],
[1,1,0],
[0,0,0],
]
# define a start and end goals (x, y) (vertical, horizontal)
start = (0, 0)
goal = (2, 0)
# search
path = AStar(world).search(start, goal)
print(path)
# should be:
# [(0, 0), (0, 1), (0, 2), (1, 2), (2, 2), (2, 1), (2, 0)]
path returns a list with (x, y) tuples with each step to reach that goal!
random map with animation!
from astar.demo import make_a_maze, walk_through
if __name__ == "__main__":
# Given a map size
size_x, size_y = 16, 32
# Build a map
world = make_a_maze(size_x, size_y, density=0.1)
# Set start and end goal
start = (0, 0)
goal = (size_x-1, size_y-1)
# Search for path
path = AStar(world).search(start, goal)
# Show the path
walk_through(world, path)
more examples:
Please take a look in the examples/ dir for some cool examples how to use it.
testing:
pytest
If you find it useful give it a star :D
Metadata
Release files for python-astar 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-astar-0.1.0.tar.gz | 16.7 kB | Without provenance | Details for python-astar-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_astar-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for python_astar-0.1.0-py3-none-any.whl |
Total release size: 34.3 kB
Release files / python-astar-0.1.0.tar.gz
| Download URL | python-astar-0.1.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
101252b33cdbc6ff269030afe584fae011f17b9f49f94441c050d9e4974cbbd4
|
|
BLAKE2b-256 checksum How to use checksums |
e59ddfb2ff104f2fde010c958f85ccf5ed8ccdbaf344149619c6840db1bb819f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.2
|
Release files / python_astar-0.1.0-py3-none-any.whl
| Download URL | python_astar-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5707ce6c691fadcd4d5cf778c876c28872e608f9a170bd4a59cf6c28ef3a137a
|
|
BLAKE2b-256 checksum How to use checksums |
dce459f2c1f14e863aa7290d837b391b39fd1dd5af0ef1f2bc3b27d3fb24c11d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.2
|
Security for python-astar 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.