A simple to use library for finding the shortest path in a grid.
Project description
gtravyl
gtravyl provides an easy way to take a grid-like layout and compute the shortest distance from any two desired cells in the grid.
How does it work?
Suppose you are trying to create a real time strategy game. You may have a grid-like map internally represented as a numpy array. It might look something like:
0001111
0001111
0000000
1101110
1101110
where the 1 indicates you cannot travel into that cell. Now you want to move a character that is in the cell with index (0, 0) to the bottom right corner. Ideally, you would like to know the shortest path too. This can be done easily with gtravyl, observe:
import numpy as np
import gtravyl as gt
world = np.array([[0, 0, 0, 1, 1, 1, 1],
[0, 0, 0, 1, 1, 1, 1],
[0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 1, 1, 1, 0],
[1, 1, 0, 1, 1, 1, 0]])
path = gt.shortest_path(world, (0, 0), (4, 6))
for cell in path:
world[cell] = 2
print(world)
This gives a path (represented by the cells with 2) that looks like one should expect:
[[2 2 2 1 1 1 1]
[0 0 2 1 1 1 1]
[0 0 2 2 2 2 2]
[1 1 0 1 1 1 2]
[1 1 0 1 1 1 2]]
Documentation
More documentation can be found on readthedocs.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gtravyl-0.1.6.tar.gz.
File metadata
- Download URL: gtravyl-0.1.6.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ccc75b0ad90972981c9670b63ab9fb33b89cf66132f54026323869e2f184093
|
|
| MD5 |
e90935adcdc179b2ce31eb9825ef32e3
|
|
| BLAKE2b-256 |
08f92b0dd651fbae48ede687169a07257d915181944e1d5d2a3515d39393c5cc
|
Provenance
The following attestation bundles were made for gtravyl-0.1.6.tar.gz:
Publisher:
python-publish.yml on thyrgle/gtravyl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gtravyl-0.1.6.tar.gz -
Subject digest:
1ccc75b0ad90972981c9670b63ab9fb33b89cf66132f54026323869e2f184093 - Sigstore transparency entry: 1500872708
- Sigstore integration time:
-
Permalink:
thyrgle/gtravyl@0368eb37b9f8428ebe2a014a5329fa5c9af80b6e -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/thyrgle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0368eb37b9f8428ebe2a014a5329fa5c9af80b6e -
Trigger Event:
release
-
Statement type:
File details
Details for the file gtravyl-0.1.6-py3-none-any.whl.
File metadata
- Download URL: gtravyl-0.1.6-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f88a51a7b050b09ba8fdd2561315b39d97ae3b09c163611e06401b603fc0c1d
|
|
| MD5 |
86a2837b58f89c7e8737f2be5e74f3d8
|
|
| BLAKE2b-256 |
4fcd44f994b8c50020885c27f11e05fcd758cc8e3c340687123abc329180baf7
|
Provenance
The following attestation bundles were made for gtravyl-0.1.6-py3-none-any.whl:
Publisher:
python-publish.yml on thyrgle/gtravyl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gtravyl-0.1.6-py3-none-any.whl -
Subject digest:
3f88a51a7b050b09ba8fdd2561315b39d97ae3b09c163611e06401b603fc0c1d - Sigstore transparency entry: 1500872716
- Sigstore integration time:
-
Permalink:
thyrgle/gtravyl@0368eb37b9f8428ebe2a014a5329fa5c9af80b6e -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/thyrgle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0368eb37b9f8428ebe2a014a5329fa5c9af80b6e -
Trigger Event:
release
-
Statement type: